diff --git a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt index 2d4b8bbde..981d4bc68 100644 --- a/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/TTSReadAloudService.kt @@ -1,6 +1,7 @@ package io.legado.app.service import android.app.PendingIntent +import android.content.Intent import android.speech.tts.TextToSpeech import android.speech.tts.UtteranceProgressListener import io.legado.app.R @@ -40,6 +41,12 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener upSpeechRate() } + override fun onTaskRemoved(rootIntent: Intent?) { + super.onTaskRemoved(rootIntent) + clearTTS() + stopSelf() + } + private fun initTts() { ttsInitFinish = false textToSpeech = TextToSpeech(this, this)