6

I'm trying to use SpeechRecognizer on Android without Intent Dialog. It works fine on most of devices but some devices return Audio Recording Error (Error Code 3) and There's no detail for this error. Is there any solution or reason for this?

Thank you!!

Android Work
  • 61
  • 1
  • 3

4 Answers4

16

I had the same error when Google App(com.google.android.googlequicksearchbox) does not have recording permission.

In addition, SpeechRecognizer uses service of com.google.android.googlequicksearchbox. Thus, if this app is disabled or uninstalled, SpeechRecognizer may not work.

realhoon
  • 171
  • 1
  • 7
  • 3
    This answer worked for me. Go to Settings -> Apps in your mobile and give 'Recording' permission to Google app. – UzumakiL Oct 27 '18 at 09:42
7

You should go to system setting, Apps, Google app, then enable its permission of microphone. That's exactly the cause of ERROR_AUDIO(Error Code 3).

Fisher
  • 488
  • 7
  • 24
2
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

Set this in your manifest. if still not working, then state which device is causing error.

Zafar Kurbonov
  • 2,077
  • 4
  • 19
  • 42
-2

Error Code 6 means Error Speech Timeout, while Audio Recording Error has value 3 (see here: https://developer.android.com/reference/android/speech/SpeechRecognizer.html). Assuming that you have Error Speech Timeout, you can do the following:

public void OnError(SpeechRecognizerError error) {
String errorMessage = error.ToString();
    if (errorMessage.Contains ("SpeechTimeout"))
                {   this.OnDestroy();
                    this.OnCreate();
                }
}

This will allow you to restart your SpeechRecognizer.

On the other hand, if you are having difficulties with Audio Recording Error, I'd be glad to find the solution, since I'm facing the same problem.

G Eazy
  • 5
  • 2