TextToSpeech.setEngineByPackageName () does not set anything

Following the hint in this answer , I put the 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 of whether I check or cancel the installation Always use my settingsin the text-to-speech settings, I always get the default pico mechanism !

Yes, I intentionally set the default value of the pico engine parameter, so I can check its redefinition using the above tip . But this API method does not seem to work at all, or ... did I miss something?

(I know that setEngineByPackageName is deprecated since it does not tell the caller when the TTS engine is initialized, but I need to support API 8, so this method is my only option at the moment)

+4
source share
1 answer

You say you put the setEngineByPackageName call into onActivityResult(). This is the wrong place for this.

setEngineByPackageName, like getDefaultEngine, does not need to be called before reaching onInit().

+5
source

All Articles