杀死应用时停止朗读

pull/328/head
gedoor 4 years ago
parent 7c55a715a7
commit 9b4a8d862e
  1. 6
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

@ -1,6 +1,7 @@
package io.legado.app.service
import android.app.PendingIntent
import android.content.Intent
import android.media.MediaPlayer
import io.legado.app.constant.EventBus
import io.legado.app.help.AppConfig
@ -36,6 +37,11 @@ class HttpReadAloudService : BaseReadAloudService(),
mediaPlayer.setOnCompletionListener(this)
}
override fun onTaskRemoved(rootIntent: Intent?) {
super.onTaskRemoved(rootIntent)
stopSelf()
}
override fun onDestroy() {
super.onDestroy()
task?.cancel()

Loading…
Cancel
Save