Android Question VoiceRecognition Offline

Almog

Active Member
Licensed User
Hello,

I tried to use Voice Recognition offline with intent. https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_PREFER_OFFLINE

B4X:
Dim VR As VoiceRecognition
Dim i As Intent
VR.Initialize("vr")
i.Initialize("android.speech.action.RECOGNIZE_SPEECH", "")
i.PutExtra("android.speech.extra.PREFER_OFFLINE", 1000)
VR.Listen2(i)

but the voice recognition is not working offline.

Does anybody know why its happening and if there is a way to fix it? (and how?)

Thanks in advance.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You don't need to do anything special for this. If the speech engine supports offline mode then it will just work.

Tested with this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   vr.Initialize("vr")
End Sub
Sub Activity_Click
   vr.Listen
   Wait For vr_Result (Success As Boolean, Texts As List)
   Activity.Title = Texts
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…