Reattach the detached service notification when the app is swiped (if not playing) for it be removed with the application.
This commit is contained in:
parent
eb6b7a807b
commit
b6b9e4c053
|
@ -217,6 +217,16 @@ class PlayerService : Service() {
|
|||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
super.onTaskRemoved(rootIntent)
|
||||
|
||||
if (!player.playWhenReady) {
|
||||
mediaControlsManager.updateNotification(queue.current(), false)
|
||||
|
||||
stopSelf()
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun onDestroy() {
|
||||
scope.cancel()
|
||||
|
@ -243,9 +253,6 @@ class PlayerService : Service() {
|
|||
setPlaybackState(false)
|
||||
player.release()
|
||||
|
||||
stopForeground(true)
|
||||
stopSelf()
|
||||
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue