Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

relaunch recognition in case of error #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/android/com/pbakondy/SpeechRecognition.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ public void onEndOfSpeech() {
public void onError(int errorCode) {
String errorMessage = getErrorText(errorCode);
Log.d(LOG_TAG, "Error: " + errorMessage);
recognizer.stopListening();
recognizer.cancel();
recognizer.destroy();
recognizer.startListening();
callbackContext.error(errorMessage);
}

Expand Down