Speech Recognition: "Network error" on startListening() Android 6/7


#1

When I run the code below, as soon as the beep sounds to start recording the mic, I get “Network error”:

I have no idea what’s wrong here. I’ve:

  • added the: cordova plugin + npm module correctly,
  • granted permissions in the app for microphone
  • tried connected to WIfi
  • tried connected to 4g
  • tried removing and re-adding the android platform to the project
  • tried on 2 different phones (samsung s5 android 6 / sony xperia z5c android 7)

Any ideas? Thanks!

  setupSpeechRecognition() {
    this.speechRecognition.requestPermission().then(() => {
        this.speechRecognition.startListening().subscribe(
            (matches) => {
              // matches here...
            },
            (onerror) => {
              alert("Error: " + JSON.stringify(onerror));
            }
        );          
      },
      () => {}
    );      
  }

#2

I Got the same issue with almost the same code but only with 1 phone (android 4.4.2)
I don’t know wher to search, if you find the solution, please share it.
Thanks !