Hi,
I have an app that use SpeechRecognition and TTS functionality : I use TTSID and SpeechRecognition_NoUi Libraries.
My app work perfectly if the device have SR and TTS enabled by defaut, which is the case for most android devices, especially those with Google services enabled.
If this is not the case (I notice this with cheap Android Tablets for ex..) , the user have to install « Google » app and « Google voice » in Google Play.
At the first start of app, I want to check if TTS and SR are enabled on the device. If yes: activate TTS and SR functionalities, If no disable them.
For Speech recognition: it’s ok.
I can do it well with SpeechRecognition_NoUi library, it’s contain a native function to test it:
I want to do it also for TTSID. I test it on device wich have no tts enabled or installed.
And it naturally give me an error:
How can I check if TTS is available on device/ installed , the same as i do with SR function ( a kind of tts.isTTSAvailable function) ?
Thank you for your help.
I have an app that use SpeechRecognition and TTS functionality : I use TTSID and SpeechRecognition_NoUi Libraries.
My app work perfectly if the device have SR and TTS enabled by defaut, which is the case for most android devices, especially those with Google services enabled.
If this is not the case (I notice this with cheap Android Tablets for ex..) , the user have to install « Google » app and « Google voice » in Google Play.
At the first start of app, I want to check if TTS and SR are enabled on the device. If yes: activate TTS and SR functionalities, If no disable them.
For Speech recognition: it’s ok.
I can do it well with SpeechRecognition_NoUi library, it’s contain a native function to test it:
B4X:
If sr.IsRecognitionAvailable Then
'Enable SR functionalities in the app
Else
'disable SR functionalites in the app
End If
I want to do it also for TTSID. I test it on device wich have no tts enabled or installed.
And it naturally give me an error:
java.lang.RuntimeException: java.lang.RuntimeException: Error speaking text.
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1706)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.RuntimeException: Error speaking text.
at anywheresoftware.b4a.obejcts.TTS.Speak(TTS.java:62)
at b4a.example.ttsid._vv7(ttsid.java:287)
... 7 more
How can I check if TTS is available on device/ installed , the same as i do with SR function ( a kind of tts.isTTSAvailable function) ?
Thank you for your help.
Last edited: