当googlequicksearchbox处于后台

时间:2015-09-09 14:40:15

标签: android speech-recognition google-search

此行为与描述here非常相似,但仅在googlequicksearchbox处于后台时才会发生。我使用谷歌APP 5.2.33.19.arm。

我通过调用

创建了SpeechRecognizer
SpeechRecognizer.createSpeechRecognizer(myContext, new ComponentName("com.google.android.googlequicksearchbox", "com.google.android.voicesearch.serviceapi.GoogleRecognitionService"))

我在Android Studio Logcat中收到以下错误消息

GoogleRecognitionServic﹕ #startListening [es-MX]
WebAppState﹕ WebApp unloaded
MediaFocusControl﹕ AudioFocus  requestAudioFocus() from android.media.AudioManager@b4542c6com.google.android.voicesearch.a.a$1@11f9f287 req=4flags=0x0
MediaFocusControl﹕ AudioFocus  abandonAudioFocus() from android.media.AudioManager@b4542c6com.google.android.voicesearch.a.a$1@11f9f287
Greco3EngineManager﹕ create_rm: m=ENDPOINTER_DICTATION,l=en-US
Greco3EngineManager﹕ Brought up new g3 instance :/system/usr/srec/en-US/endpointer_dictation.config for: en-USin: 1 ms
ErrorReporter﹕ reportError [type: 211, code: 458760]: es-MX
ErrorProcessor﹕ onFatalError, ignoring error from engine(1): com.google.android.apps.gsa.shared.speech.a.f: es-MX
ErrorReporter﹕ reportError [type: 211, code: 458756]: GsaErrorCode: 458756, engine: 1
ErrorProcessor﹕ onFatalError, ignoring error from engine(1): com.google.android.apps.gsa.shared.speech.a.d: GsaErrorCode: 458756, engine: 1
GoogleSpeechRecognition﹕ onError No match

以下是来自语音识别器的全部消息。在完成后还有一个ERROR_CLIENT。另一件事是当发生这种情况时没有onRmsChanged调用。通常,在正常识别请求期间有大量此呼叫。

googleRecognizer﹕ onError No match
googleRecognizer﹕ onReadyForSpeech
googleRecognizer﹕ onBeginningOfSpeech
googleRecognizer﹕ onPartialResults
googleRecognizer﹕ onPartialResults
googleRecognizer﹕ onPartialResults
googleRecognizer﹕ onPartialResults
googleRecognizer﹕ onPartialResults
googleRecognizer﹕ onEndOfSpeech
googleRecognizer﹕ onError Client side error
googleRecognizer﹕ onResults

1 个答案:

答案 0 :(得分:0)

您需要先了解SpeechRecognizer的功能。 SpeechRecognizer向手机上的默认语音到文本应用程序发送“唤醒呼叫”(这可以在设置 - >语言和输入上看到)。默认应用程序唤醒,将您的语音转换为文本,然后将其发送给您onResults。在您的具体情况下,您明确地称之为“谷歌搜索”。

SpeechRecognizer.createSpeechRecognizer(..."com.google.android.googlequicksearchbox"...)

我会说,当'googlequicksearchbox'在后台运行时,识别器无法使用它(因为此操作只能有一个实例)。

尝试为文字应用调用不同的语音,看看会发生什么。