EddyVerbruggen / nativescript-speech-recognition

:speech_balloon: Speech to text, using the awesome engines readily available on the device.
Other
90 stars 23 forks source link

onError callback in options for android #23

Closed Shne closed 6 years ago

Shne commented 6 years ago

Added an optional onError callback to the options object. It is called on errors in Android and provides the error code from the SpeechRecognizer of Android. A link to the error codes is provided in the doc comment. I don't know if there's a place it should also be called on iOS, as I'm only using this on Android.

I have tested that it works and I use it to restart listening when nothing is recognized or recognition times out (error codes 6 ERROR_SPEECH_TIMEOUT and 7 ERROR_NO_MATCH).

EddyVerbruggen commented 6 years ago

You're right, those errors get lost. I'll look at this PR and at the iOS side as well. Thanks!