Voice recognition & dialing

HotShoe

Well-Known Member
Licensed User
Longtime User
I have a dialer app that I am updating. Everything has worked fine in the past, but now I am getting a "Connection Problem" when I try to use the voice dial function.

This is the Activity_Create sub that I am using"

B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
   
   Activity.LoadLayout("main")
   cfchanged = False
   cbchanged = False
   
   im.Initialize("im")
   pe.InitializeWithPhoneState("pe",pid)
   inconfig = False
   offhook = False
   
   Tds.Initialize("Tds") 'TTS object
   vr.Initialize("vr") 'Voice recognition object
   
   If vr.IsSupported Then
   vr.Prompt = "Contact name"
   vrok = True
   Else 
    vrok = False
   End If
   
   getcfg
   getcontacts
   dialpnl.Color = crec.pback
   
End Sub

This is the key click event for the voice dial key:

B4X:
Sub voicekey_Click
      
   If vrok Then
   vr.Listen
   End If
   
End Sub

As soon as the vr.listen is executed, I get the error. It does not go to vr_Result until I hit the Cancel button on the voice prompt dialog, which of course returns false because of the error.

The factory dialer works fine for voice dial, but this dialer does the same thing on a friends phone (my other devices are not live phones). I don't see where the problem is, and the old version was not doing this. I have b4a version 2.71 and it is using the phone v1.10 library and the TTS v1.00 library.

Anyone else run into this or have an idea where I can look for this error?
 
Last edited:

HotShoe

Well-Known Member
Licensed User
Longtime User
Which error do you get?

Note that VoiceRecognition and PhoneEvents should be process global variables and should only be initialized when FirstTime is true.


I found the problem. Apparently the factory dialer does not need an active internet connection to work, but the phone library VR does. Once I enable data or turn on wifi it works as expected.

Thanks,

--- Jem
 
Upvote 0
Top