Ensure the MusicPlayer cleans up properly
This commit is contained in:
parent
824a6b4806
commit
197d529fe6
@ -262,12 +262,14 @@ public class MusicPlayer implements Runnable, MediaPlayer.OnCompletionListener,
|
||||
public void release()
|
||||
{
|
||||
if (mMediaPlayer != null) {
|
||||
pause();
|
||||
if (mMediaPlayer.isPlaying())
|
||||
mMediaPlayer.pause();
|
||||
mMediaPlayer.release();
|
||||
mMediaPlayer = null;
|
||||
}
|
||||
|
||||
mService.unregisterReceiver(mReceiver);
|
||||
mService.stopForegroundCompat(NOTIFICATION_ID);
|
||||
|
||||
if (mWakeLock != null && mWakeLock.isHeld())
|
||||
mWakeLock.release();
|
||||
|
Loading…
x
Reference in New Issue
Block a user