I'm developing an app for android that uses TTS. I've created a splash screen where I check if the TTS engine is installed and in case that is not installed, it goes to Google Play to download it.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
...
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
...
if (requestCode == PersonalTextToSpeech.MY_DATA_CHECK_CODE)
{
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
{
mTts = new TextToSpeech(context, this);
} else
{
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
context.startActivity(installIntent);
}
}
}
It was working fine in Samsung devices with 2.2 and 2.3.x OS. It goes to Google Play if needed, but now I've tried with a Samsung Galaxy S3 (with 4.1.1), which has 2 TTS installed by default (Samsung and Google), so I get a dialog asking to select one.
If the user selects Samsung it works perfect, but if the user selects Google, it goes to Settings --> Language and input --> Text-to-speech output --> Google Text-to-speech Engine --> Settings --> Install Voice Data and I get this:
So, I have 3 questions/problems:
- Is there any way to force programatically to use Samsung TTS without asking?
- My device is from Spain, but if I change the language to English, this one is not available in my Google list of TTS languages, and I can't find a way to add it (see screenshot #2).
- If I change the language to spanish, this language is supposed to be installed in my device (see screenshot #2), but for some reason TTS
resultCode
isLANG_NOT_SUPPORTED (-2)
.
In fact, right now while I write this, I've just found something weird.
If you select Samsung TTS, it will "work" (resultCode
= CHECK_VOICE_DATA_PASS (1)
), but the "voice sound" will change depending on how you have your setting (view Screenshot #3):
If you choose Samsung, it will use Samsung TTS or Google TTS according to what you have selected in: Settings --> Language and input --> Text-to-speech output.
So, even if you select Samsung TTS, you could be using Google TTS, but if you select Google TTS directly (see Screenshot #1) it will fail.
Can someone explain me what I'm doing wrong?
Thanks for your help.