Android Question TTS dont work on Android 2.3

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.
Some days ago i m posted one app in the forum
https://www.b4x.com/android/forum/threads/leitor-de-texto-text-reader.61168/

this apps its like the erel example
https://www.b4x.com/android/forum/threads/android-text-to-speech-example.7043/

today one user sended me this image ANDROID 2.3
12366849_171388113215932_1038465428_n.jpg


the original image ANDROID 5.1.1
4.png




The android 2.3 dont speak and dont list the language.

on the google i found this
http://stackoverflow.com/questions/...ch-is-not-working-in-ginger-bread-android-2-3

http://stackoverflow.com/questions/...download-android-tts-engine/16836553#16836553

http://stackoverflow.com/questions/17208853/how-to-create-a-tts-engine-for-android-2-3

but how to fix this bug on Android 2.3 in B4A?

This intent will work? and how to make this intent in b4a?
B4X:
private void installVoiceData() {
    Intent intent = new Intent(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage("com.google.android.tts"/*replace with the package name of the target TTS engine*/);
    try {
        Log.v(TAG, "Installing voice data: " + intent.toUri(0));
        startActivity(intent);
    } catch (ActivityNotFoundException ex) {
        Log.e(TAG, "Failed to install TTS data, no acitivty found for " + intent + ")");
    }
}


thx all
 

Douglas Farias

Expert
Licensed User
Longtime User
What happens if you call speak without setting the language?
no, i open the app, (my app), and the app dont list the languages and dont speak

i m using your example here
https://www.b4x.com/android/forum/threads/listing-selecting-tts-voices.14004/

B4X:
Sub TTS1_Ready (Success As Boolean)
   If Success Then
      Dim listOfSupported As List
      listOfSupported.Initialize
      For i = 0 To AllLocales.Length - 1
         Dim s() As String
         s = Regex.Split("_", AllLocales(i))
         If s.Length = 1 Then
             If tts1.SetLanguage(s(0), "") = True Then listOfSupported.Add(AllLocales(i))
         Else
            If tts1.SetLanguage(s(0), s(1)) = True Then listOfSupported.Add(AllLocales(i))
         End If
      Next
      For i = 0 To listOfSupported.Size - 1
         Log(listOfSupported.Get(i)) 'print to the log
      Next
   End If
End Sub

i think android 2.3 dont have tts already instaled.

i need check if device is 2.3 and open intent with
https://play.google.com/store/apps/details?id=com.google.android.tts
to fix this on android 2.3?

no way to auto instal google tts?
 
Last edited:
Upvote 0
Top