Android Question Library TTS 1.0 and Camera permission in Android 9

giacomo-italy

Member
Licensed User
Longtime User
I have a problem with TTS library and camera permission in Adroid 9.
Can anyone tell me if it work in Android 9?
Thank you
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
working ok on android 10 (sdk28 and sdk29). sorry, i don't have android 9 device.
 
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
I try to describe what happened to me:
for a long time I used b4a 5.50,
compiled the code with targetsdkversion = 14,
and installed on an android 6.0.1 device,
the apps with the TTS library worked well, without problems.

Recently I purchased a new mobile phone with android 9,
I installed the new b4a 9.80,
recompiling the code with targetsdkversion = 14,
the apps work but the TTS features don't work (and the warning appears: 'the app is developed for an older version of android...').

I tried to set targetsdkversion higher but TTS don't work.
Putting targetsdkversion greater than 21 in addition to TTS features other feature of the apps also don't work.

I don't have the skills to understand what happens and to know what settings I need to do...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
Create a new project. start with the manifest from the new app. The targetsdk should be 28.

android.jar / targetSdkVersion / minSdkVersion
I tried to set targetsdkversion =28
the apps don't work and TTS features don't work

with targetsdkversion = 14,
the apps work but only the TTS features don't work (and the warning appears: 'the app is developed for an older version of android...').
 
Last edited:
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
And the error is?

Sorry, you are not giving enough informations to help you.
I try.
The app is installed but,

First case:
with targetsdkversion = 14,
no error
-all features of the apps work
-only the TTS features don't work: When i call tt.Speak("word",False) (tt as TTS is a global variable) don't speak, and the app continue to work other features

Second case:
I tried to set targetsdkversion =28
one error
-the apps don't work: error=java.lang.RuntimeException: Fail to connect to camera service (the app use camera service to manage image of the camera)
-TTS features don't work
 
Last edited:
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
Someone can help me to solve this problem with Android 9 (and targetsdkversion =28) ?
-TTS library features don't work: When i call tt.Speak("word",False) (tt as TTS is a global variable) don't speak
-error=java.lang.RuntimeException: Fail to connect to camera service
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
tt.Speak("word",False)
is not enough for tts to function. is tts ready?

Fail to connect to camera service
is a completely different problem. when sdk = 28, you need runtime permissions.

it sounds like you have several serious problems. you should deal with tts and camera problems separately. start with tts. when i set sdk = 14, tts works on my device. post your code relating to tts. did you initialiaze tts? did you handle the tts ready event? can you hear sound on your device?
 
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
is not enough for tts to function. is tts ready?


is a completely different problem. when sdk = 28, you need runtime permissions.

it sounds like you have several serious problems. you should deal with tts and camera problems separately. start with tts. when i set sdk = 14, tts works on my device. post your code relating to tts. did you initialiaze tts? did you handle the tts ready event? can you hear sound on your device?

-Solved the problem with TTS, it work with sdk 14 and 28 (in my code there was a problem in handle tts ready event). Thank you

-For camera failure connection with sdk = 28 how can i solve the runtime permissions problem?

For my tests I am using the original Erel files:
 

Attachments

  • TTSExample.zip
    406.5 KB · Views: 140
  • CameraCCTVClient.zip
    10.3 KB · Views: 128
Last edited:
Upvote 0

giacomo-italy

Member
Licensed User
Longtime User
I solved it this way:

-I added the starter.bas service module to project (attached file)
-I changed the Sub InitializeCamera like this (as well as from the code of the Erel example CameraExe)(attached file) :

B4X:
'Private Sub InitializeCamera
'    camEx.Initialize(Panel1, frontCamera, Me, "Camera1")
'End Sub
Private Sub InitializeCamera
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        camEx.Initialize(Panel1, frontCamera, Me, "Camera1")
        'frontCamera = camEx.Front
    Else
        ToastMessageShow("No permission!!!", True)
    End If
End Sub

Now the camera (after applying for a permit) always opens at every start.
Thank you all
 

Attachments

  • Starter.bas
    584 bytes · Views: 123
  • CameraEx.zip
    13.2 KB · Views: 140
Upvote 0
Top