4

Following the tip in this answer, I placed a call to setEngineByPackageName right in onActivityResult(), when requestCode == REQ_TTS_STATUS_CHECK && TextToSpeech.Engine.CHECK_VOICE_DATA_PASS:

  tts = new TextToSpeech(this, this);
  tts.setEngineByPackageName("com.ivona.tts.voicebeta.eng.usa.kendra");          

But regardless whether I check or uncheck the Always use my settings in Text-to-speech settings, I always get the pico default engine!

Yes, I intentionally set the pico engine to be the default, so that I can test overriding it by the aforementioned tip. But that API method seems not to be working at all, or... am I missing something?

(I know that setEngineByPackageName is deprecated, since it doesn't inform caller when the TTS engine has been initialized, but I need to support API 8, so this method is my only option at the moment)

Community
  • 1
  • 1
an00b
  • 11,338
  • 13
  • 64
  • 101

1 Answers1

5

You say that you placed the call to setEngineByPackageName in onActivityResult(). This is the wrong place to do this.

setEngineByPackageName, just like getDefaultEngine, must not be called before reaching onInit().

Eternal Learner
  • 2,602
  • 5
  • 27
  • 38