voice
voice copied to clipboard
why onSpeechRecognized is not called in Android(Very Urgent)
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.
Reference: https://stackoverflow.com/questions/46376193/android-speechrecognizer-audio-recording-error/48006238#48006238
The year is 2024. I have run into this same problem. It seems that it has never been fixed? Has anyone found a solution at all? I see the same problem on both the emulator (API 34) and on a physical phone (Google Pixel 7 Pro). In my case, I am using react-native and the react-native-voice interface over the Android Voice interface.
One strange thing, I see two onAudioStart events in a row, instead of onSpeechStartfollowed by onSpeechRecognized. Some of this may be RNV's say of handling the problem in the native layer. Anyone have any experience with this?
@adrian-kaehler Hello Do you have any updates how to fix it?
@YaremaV sadly, no. This issue seems to have never been resolved and, so far as I know, remains a bug in RNV. There is a (poor) workaround that I found, which is that where onSpeechRecognized is expected, one will often see a second onSpeechStart call. This seems satisfactory under normal operating conditions (i.e. to count the onSpeechStart calls and look for the second one in sequence), but it is not generally robust. There are too many situations in which this simple approach will not give reliable results. I, and others, have posted about it on Android dev boards, but so far, I haven't seen any action on this. I am not sure why it's not a higher priority, it really makes RNV not work reliably.
LBNL, I did some digging into the Android native library that RNV is wrapping around. I don't recall everything I found (this was a while ago...) but it was my recollection that the bug is directly inherited from the native library, not a feature of RNV specifically. Maybe others can chime in on this who have done this digging. Don't take this recollection of mine as gospel. ;P
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
Add the Above code block in the AndroidManifest.xml of @react-native-voice\voice
Path: \node_modules**@react-native-voice\voice**\android\src\main*AndroidManifest.xml*
This works for me.