Android Question TTS Text to Speech Library initializes on targetSdkVersion 29 or less but not on 30 or 31

MichaelAust

Member
Licensed User
Longtime User
Having got a newer phone with Android 13, I am working through getting an app of mine working properly on it, and I would like to have TTS working in this app.
I have attached a small project which is based on the code posted by Erel in the thread https://www.b4x.com/android/forum/threads/google-tts-key_param_pan-parameter-implementation.127635/
I have done a lot of searching, and that was the most recent TTS related thread I could find.
The library works fine when targetSdkVersion is 28 or 29 in the Manifest Editor, but doesn't initialize (the button is greyed out) when it is set to 30 or 31
I am running B4A 12.20, and have installed the latest jdk and command line tools.
I thought it might be permission related, but Logs > List Permissions only shows android.permission.FOREGROUND_SERVICE so I don't think that is the problem.
Any help would be greatly appreciated.
 

Attachments

  • TTS_MyTest3.zip
    10 KB · Views: 146

DonManfred

Expert
Licensed User
Longtime User
A B4XPages must be exported with the link in Mainpage

B4X:
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
 
Upvote 0

MichaelAust

Member
Licensed User
Longtime User
I guess I will just set targetSdkVersion to 29, the rest of the app should be fine.
The phone it doesn't work on is a Pixel 4a 5g, but with Graphene os, so that is probably it,
Thanks for testing my code.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
You use the internal B4A TTS library, which is not fully comply with the current Android API 33 level. I have fixed those errors in the original TTS jar with the m3TTS.jar Bare Bone Text To Speech (TTS) with Speech Synthesis Markup Language (SSML) tool. You can try this m3TTS library to see if this is working with configuration.
External m3TTS use:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
'    Private tts As TTS    ' --- Replace with m3TTS
    Private tts As M3TTS

    Private Button1 As B4XView
End Sub
 
Upvote 0
Top