an00b
an00b

Reputation: 11468

TextToSpeech.setEngineByPackageName() doesn't set anything

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)

Upvotes: 4

Views: 1129

Answers (1)

Eternal Learner
Eternal Learner

Reputation: 2632

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().

Upvotes: 5

Related Questions