pbakondy / cordova-plugin-speechrecognition

:microphone: Cordova Plugin for Speech Recognition
MIT License
196 stars 117 forks source link

showPopup: false - no match in Android 6.x #15

Open tmk1 opened 7 years ago

tmk1 commented 7 years ago

Option showPopup: false causes errors in Android 6. First use is OK - I get list of matches, but the second and every next try - it fails. There is an immediate response: No match (it's not even waiting for me to stop talking). Few times there was also RecognitionService busy info.

With showPopup: true everything works just fine.

On Android 5 everything works fine in both cases. I was trying en-US and pl-PL.

I use the newest version of the plugin and Cordova. Android 6 - Samsug Galaxy A5 model 2016 - Android 6.0.1 Android 5 - Samsung Galaxy S4 - Android 5.0.1

akane-tendo commented 7 years ago

Hi all, I have the same issue! Android 6 - Samsug Galaxy S5 - Android 6.0.1

I'm trying to debug and this is the log:

First request: 03-28 12:00:00.744 25204 25291 D SpeechRecognition: execute() action hasPermission 03-28 12:00:00.794 25204 25291 D SpeechRecognition: execute() action startListening 03-28 12:00:00.804 25204 25291 D SpeechRecognition: startListening() language: en-US, matches: 1, prompt: null, showPopup: false 03-28 12:00:01.054 25204 25204 D SpeechRecognition: onReadyForSpeech 03-28 12:00:03.404 25204 25204 D SpeechRecognition: SpeechRecognitionListener results: [hi, hey, High, hype, height]

Second request: 03-28 12:00:12.534 25204 25291 D SpeechRecognition: execute() action hasPermission 03-28 12:00:12.584 25204 25291 D SpeechRecognition: execute() action startListening 03-28 12:00:12.584 25204 25291 D SpeechRecognition: startListening() language: en-US, matches: 1, prompt: null, showPopup: false 03-28 12:00:12.604 25204 25204 D SpeechRecognition: Error: No match (7) 03-28 12:00:12.814 25204 25204 D SpeechRecognition: onReadyForSpeech 03-28 12:00:14.894 25204 25204 D SpeechRecognition: SpeechRecognitionListener results: [hello, Helo, hellooooo, helloooooo, helllo

As you can see, in the second request, the device answer with "No Match", but after this, the device is "onReadyForSpeech" and receive the voice correctly.

For now, what I did to figure out quicky (is not a solution), I have changed the .java in:

public void onError(int errorCode) { String errorMessage = getErrorText(errorCode); Log.d(LOG_TAG, "Error (" + errorCode + "): " + errorMessage); if (errorCode !== 7) { //7 = No Match callbackContext.error(errorMessage); } }

And works.

I hope to work with the developer to find a better solution.

Thanks

akane-tendo commented 7 years ago

Found the issue (in my scenario). Google App old version. Just updated the Google App with a last version and all good.