diff --git a/app/src/main/java/io/legado/app/service/ReadAloudService.kt b/app/src/main/java/io/legado/app/service/ReadAloudService.kt index baa368760..e3c47eec2 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -345,12 +345,13 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, mediaSessionCompat?.isActive = true } + /** + * 断开耳机监听 + */ private fun initBroadcastReceiver() { - //断开耳机监听 broadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { - val action = intent.action - if (AudioManager.ACTION_AUDIO_BECOMING_NOISY == action) { + if (AudioManager.ACTION_AUDIO_BECOMING_NOISY == intent.action) { pauseReadAloud(true) } }