Text to Speech crash on Instant Apps

Viewed 456

I'm in the process of implementing an instant app that makes use of the Text to Speech functionality available on Android devices. I have managed to get a TextToSpeech instance initialized and working correctly for non-instant apps by following the instructions detailed in the Android dev blog post An introduction to Text-To-Speech in Android

I have refactored my app to be an instant app and have confirmed that the Text to Speech functionality is working in the non-instant app. However when running the following ACTION_CHECK_TTS_DATA intent in the instant app:

val checkIntent = Intent()
checkIntent.action = TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
activity.startActivityForResult(checkIntent, initilizeTtsRequestCode)

I get the following error:

FATAL EXCEPTION: main
 Process: [PACKAGE_NAME_REDACTED], PID: 9500
 java.lang.RuntimeException: Unable to start activity ComponentInfo{[PACKAGE_NAME_REDACTED]/[PACKAGE_NAME_REDACTED].ui.SNTMainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.tts.engine.CHECK_TTS_DATA }
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
     at android.app.ActivityThread.-wrap11(Unknown Source:0)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
     at android.os.Handler.dispatchMessage(Handler.java:105)
     at android.os.Looper.loop(Looper.java:164)
     at android.app.ActivityThread.main(ActivityThread.java:6541)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.tts.engine.CHECK_TTS_DATA }
     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1936)
     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1615)
     at android.app.Activity.startActivityForResult(Activity.java:4472)
     at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:65)
     at android.app.Activity.startActivityForResult(Activity.java:4430)
     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:711)
     at [PACKAGE_NAME_REDACTED].SNTTtsManager.initialize(SNTTtsManager.kt:92)
     at [PACKAGE_NAME_REDACTED].ui.SNTMainActivity.onStart(SNTMainActivity.kt:96)
     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1333)
     at android.app.Activity.performStart(Activity.java:6992)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2780)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
     at android.app.ActivityThread.-wrap11(Unknown Source:0) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
     at android.os.Handler.dispatchMessage(Handler.java:105) 
     at android.os.Looper.loop(Looper.java:164) 
     at android.app.ActivityThread.main(ActivityThread.java:6541) 
     at java.lang.reflect.Method.invoke(Native Method) 
     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

I can't find any information about Text to Speech or similar system services not being available to Instant Apps on the Restricted features page nor FAQ. Is this a bug or is this feature not available to Instant Apps?

1 Answers
Related