Hi All,
Kindly tell me why onSpeechRecognized() is not working in Android.
I did everything like mentioned is document.
Voice.isAvailable() is also true
Kindly give me idea why it is not working
It is very important for me I am in the mid of project
please give me any solutin for this
No one gave reply to this issue.
I think its major issue
Kindly help me anyone
Did you install Google Assistance or other voice recognition engine?
yes
I am seeing the same, the first call returns a "9 / Insufficient permissions" error, but after that, everything seems to work fine but no results are returned ever.
This is my logcat output with some custom logs inside each event:
2020-06-25 14:34:12.720 2040-2826/? I/ActivityTaskManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.permissioncontroller cmp=com.google.android.permissioncontroller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity (has extras)} from uid 10264
2020-06-25 14:34:12.733 2040-2826/? I/MediaFocusControl: abandonAudioFocus() from uid/pid 10264/14304 clientId=android.media.AudioManager@64e198aexpo.modules.av.AVManager@f7a62a4
2020-06-25 14:34:12.836 14304-14371/com.thunkable.live.debug I/ReactNativeJS: WE DO HAVE THE PERMISSION
2020-06-25 14:34:12.845 14304-14371/com.thunkable.live.debug I/ReactNativeJS: 'available? ', true
2020-06-25 14:34:12.845 14304-14371/com.thunkable.live.debug I/ReactNativeJS: 'recognising?', true
After a few seconds I see this Exception:
2020-06-25 14:34:17.823 14304-15736/com.thunkable.live.debug W/ConnectionTracker: Exception thrown while unbinding
java.lang.IllegalArgumentException: Service not registered: ll@ec35e85
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1751)
at android.app.ContextImpl.unbindService(ContextImpl.java:1776)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:741)
at ce.b(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):1)
at ce.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):5)
at lm.A(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):10)
at kx.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):3)
at dx.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at iv.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (120700-0):15)
This started happening when we moved from expokit to a bare app, so my guess is that there is something wrong in the linking (or lack of linking) step. I have tried the manual linking steps but no luck so far. Will try again.
A short update: I keep seeing the permissions error in the log, even though the app brings up the pop up, the permission is granted, and you can see that the app has microphone access in settings menu:
E/RecognitionService: call for recognition service without RECORD_AUDIO permissions
This happens with a brand new expo bare app, SDK 37. I thought it would be related to the Permissions changes in SDK36, so added the expo-av module to pull in RECORD_AUDIO permissions, but still no luck.
Please run following codes and let us know what was the output.
let services = await Voice.getSpeechRecognitionServices();
console.log(services);
I am facing the same problem on IOS it's working perfectly
but on my android phone, Huawei mate 10 lite not working I tried asking for AUDIO permission and to use
await Voice.start('es_US', {
RECOGNIZER_ENGINE: 'GOOGLE',
EXTRA_PARTIAL_RESULTS: true,
});
also, I used what @Aung-Myint-Thein mention and I put the value of the services instead of GOOGLE in RECOGNIZER_ENGINE: services
the output of Voice.getSpeechRecognitionServices(); is com.google.android.googlequicksearchbox
still the same network error and onSpeechError: {"error": {"message": "9/Insufficient permissions"}}
on Emulator there is no 9/Insufficient permissions but
[Sun Aug 23 2020 03:36:48.518] LOG onSpeechVolumeChanged: {"value": -2}
[Sun Aug 23 2020 03:36:48.590] LOG onSpeechError: {"error": {"message": "2/Network error"}}
[Sun Aug 23 2020 03:36:48.789] LOG onSpeechVolumeChanged: {"value": -2.119999885559082}
[Sun Aug 23 2020 03:36:48.820] LOG onSpeechStart: {"error": false}
[Sun Aug 23 2020 03:36:48.854] LOG onSpeechVolumeChanged: {"value": -2}
[Sun Aug 23 2020 03:36:48.931] LOG onSpeechVolumeChanged: {"value": -2}
[Sun Aug 23 2020 03:36:48.956] LOG onSpeechError: {"error": {"message": "2/Network error"}}
[Sun Aug 23 2020 03:36:55.721] ERROR [TypeError: Network request failed]
please I need Help
@Aung-Myint-Thein the output for recognition services is ["com.google.android.googlequicksearchbox"].
I am not seeing the permissions error anymore on emulator, but still get no results back on Android.
@josmas I tried on emulator, but this lib not support on emulator. It's only support on real devices.
I also tested it and it only works on the physical device. Does anyone know any other way to test this on the android emulator?
In my case, I went to settings and gave recording permission to the Google app and it worked fine.
Most helpful comment
In my case, I went to settings and gave recording permission to the Google app and it worked fine.
Reference: https://stackoverflow.com/questions/46376193/android-speechrecognizer-audio-recording-error/48006238#48006238