Android Question [B4XPages] xSpeechRecognizer not working (but working in Standard B4A)

Mike1970

Well-Known Member
Licensed User
Longtime User
hi everyone, i just converted a project from b4a standard to b4xpages.
everything seems to be working, except for the xSpeechRecognizer that in the Standard project works, and in the b4xpages version not.

When i click the button to start the listening this check fails:
B4X:
        If Obj_speech.IsRecognitionAvailable Then '<------------ here'
            'Turn it on
            Obj_speech.Start
              
            'Start listening
            Obj_speech.StartListening
            Sleep(50)
            SetState(False)

        Else
            MsgboxAsync("No Recognizer", "Error")
        End If


I think the problem is here
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    ...
  
    Dim ok As Boolean = False
    Dim rp As RuntimePermissions
    Do While Not(ok)
        rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Not(Result) Then
            Msgbox2Async("Devi acconsentire per poter fare il test", "Consenti l'accesso", "Ok", "", "", Null, False)
            Wait For Msgbox_Result (ResultMsg As Int)
        Else
            ok = True
        End If
    Loop
    'Obj_speech.Initialize(Me, "Event_obj_speech", 0, 0) '<----- Tried also like so
    Obj_speech.Initialize(B4XPages.GetNativeParent(Me), "Event_obj_speech", 0, 0) '<-------------------------- HERE
End Sub

The library is this:

Thanks in advance
 

Mike1970

Well-Known Member
Licensed User
Longtime User
Yes it was that , despite in the settings the record audio authorization was enabled?‍
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…