Closed gtnunes1956 closed 6 years ago
@EddyVerbruggen Any update on the handler?
+1
"nativescript-speech-recognition": "^1.3.1" still has this issue. Any plans?
Same issue still. Any workarounds?
I've made a fork where I've added an onError callback to the options that is called with the error code when an error occurs in android. https://github.com/Shne/nativescript-speech-recognition/commit/bd64fde968959797e23a50dad33bab144e288ef2
I'll open a pull request to see if it can be merged into this and unto npm. Until then, you can use it directly by running tns plugin add https://github.com/Shne/nativescript-speech-recognition/archive/v1.3.2-OnError.tar.gz
You might need to remove the existing plugin first with tns plugin remove nativescript-speech-recognition
though I'm not sure that's necessary
Thanks! Give 1.4.0 a spin.
I'm using 1.4.0 now and it's working great.
I did have a problem with it not asking for microphone permission when starting to listen and then failing and logging
Please allow access to the Microphone and try again. (tip: pass in a reject to receive this message in your app)
After I added <uses-permission android:name="android.permission.RECORD_AUDIO" />
in the AndroidManifest.xml it worked fine again.
But I'm not entirely sure whether that is caused by a change in the plugin or something else.
@Shne Thanks for reporting back. Hmmm, that permission should be added automatically and I didn't change how that works. Can you check your node_modules/nativescript-speech-recognition/platforms/android
folder? it should contain this file which has a permission that should be merged automatically compile-time.
It could be a NativeScript-version issue. What does nativescript --version
say?
The file is there, and contains the same. My nativescript version is 4.2.3.
I believe it's just my nativescript and/or sidekick messing up. I've had problems getting it to just deploy correctly.
@Shne Thanks. I'll keep an eye on similar reports for now.
Just released 1.4.1 that may help with sidekick build issues (and should make sure manually adding that permission to your project is no longer needed).
I removed the plugin (with tns plugin remove
), removed my added permissions from AndroidManifest.xml, added the plugin again (with tns plugin add
) and built and deployed using sidekick, with webpack enabled, and it works and asks for permission!
Awesome 💪
If an error occurs during speech recognition (e.g., to force one, call "startListening" and remain silent), Android will invoke "onError". The current plugin implementation then outputs "Error: 'error-code' " to the console and invokes "reject". Because "resolve" has already been invoked within the Promise (at "onReadyForSpeech"), this has no effect, and the application has no way of knowing about the error.