fix #258, TTS読み上げ完了のブロードキャスト受信のAndroid 14対応漏れ

This commit is contained in:
tateisu 2024-01-03 00:25:58 +09:00
parent f4093abba9
commit 3c975f40ee
1 changed files with 7 additions and 4 deletions

View File

@ -191,9 +191,9 @@ class AppState(
private val ttsReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent?) {
if (intent != null) {
if (TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED == intent.action) {
log.d("tts_receiver: speech completed.")
log.i("ttsReceiver onReceive action=${intent?.action}")
when (intent?.action) {
TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED -> {
ttsSpeakEnd = SystemClock.elapsedRealtime()
handler.post(procFlushSpeechQueue)
}
@ -430,8 +430,11 @@ class AppState(
ContextCompat.registerReceiver(
context,
ttsReceiver,
IntentFilter(TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED),
ContextCompat.RECEIVER_NOT_EXPORTED,
ContextCompat.RECEIVER_EXPORTED,
// RECEIVER_NOT_EXPORTED だと読み上げ完了を受け取れない
// ContextCompat.RECEIVER_NOT_EXPORTED,
)
// tts.setOnUtteranceProgressListener( new UtteranceProgressListener() {