-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from lianglixin/functional
Functional
- Loading branch information
Showing
21 changed files
with
451 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":26,"versionName":"1.2.5.1.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":28,"versionName":"1.2.5.1.3.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package io.virtualapp.home; | ||
|
||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.media.MediaPlayer; | ||
import android.os.IBinder; | ||
import android.support.annotation.Nullable; | ||
import android.util.Log; | ||
|
||
import io.virtualapp.R; | ||
|
||
public class MakeMeLive extends Service | ||
{ | ||
private final static String TAG = MakeMeLive.class.getSimpleName(); | ||
private MediaPlayer mMediaPlayer; | ||
|
||
public MakeMeLive() | ||
{ | ||
this.mMediaPlayer = new MediaPlayer(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
Log.d(TAG, TAG + "---->onCreate,启动服务"); | ||
try | ||
{ | ||
mMediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.no_notice); | ||
mMediaPlayer.setLooping(true); | ||
} | ||
catch(Throwable e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public int onStartCommand(Intent intent, int flags, int startId) { | ||
new Thread(this::startPlayMusic).start(); | ||
return START_STICKY; | ||
} | ||
|
||
private void startPlayMusic() { | ||
if (mMediaPlayer != null) | ||
{ | ||
Log.d(TAG, "启动后台播放音乐"); | ||
mMediaPlayer.start(); | ||
} | ||
} | ||
|
||
private void stopPlayMusic() { | ||
if (mMediaPlayer != null) { | ||
Log.d(TAG, "关闭后台播放音乐"); | ||
mMediaPlayer.stop(); | ||
mMediaPlayer.release(); | ||
mMediaPlayer = null; | ||
} | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
stopPlayMusic(); | ||
Log.d(TAG, TAG + "---->onDestroy,停止服务"); | ||
// 重启自己 | ||
// Intent intent = new Intent(getApplicationContext(), MakeMeLive.class); | ||
// startService(intent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.