Speechrecognizer Causes Anr... I Need Help with Android Speech API

How can I use speech recognition without the annoying dialog in android phones

Use the SpeechRecognizer interface. Your app needs to have the RECORD_AUDIO permission, and you can then create a SpeechRecognizer, give it a RecognitionListener and then call its startListening method. You will get callbacks to the listener when the speech recognizer is ready to begin listening for speech and as it receives speech and converts it to text.

SpeechRecognizer not available when targeting Android 11

I finally found a solution.

Trying to actually use the (allegedly not available) recognizer lead to this message in the logcat :

10-13 09:19:50.273  1531  1799 I AppsFilter: interaction: PackageSetting{eb6a1b2 my.application.package/10225} -> PackageSetting{ab34503 com.google.android.googlequicksearchbox/10140} BLOCKED
10-13 09:19:50.273 1531 1799 W ActivityManager: Unable to start service Intent { act=android.speech.RecognitionService cmp=com.google.android.googlequicksearchbox/com.google.android.voicesearch.serviceapi.GoogleRecognitionService } U=0: not found
10-13 09:19:50.273 25348 25348 E SpeechRecognizer: bind to recognition service failed

So the problem seems to be related to this new Android 11 "feature", and the solution was to add a query to the manifest for the blocked intent :

<manifest ...>
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>

Using SpeechRecognizer API directly - onResults() keeps returning null

According to the documentation of the listener you need to request the results with SpeechRecognizer.RESULTS_RECOGNITION from the bundle given to onResults(). Have you tried that?

RecognizerIntent.EXTRA_RESULTS is to be used when using the RECOGNIZE_SPEECH intent.

Android SpeechRecognizer when do I get ERROR_CLIENT when starting the voice recognizer?

So after a bit of pain I manage to solve my problem regarding my glass application.

First of all I found that SpeechRecognizer only works when my glasses are connected to the internet! Even so I still received from times to times ERROR 5. That was because I have a bad connectivity to the internet and from times to times my glass just disconnected from the internet without any notifications! I think this is an issue that must be solved for the next level of glasses. It just cannot disconnect from the internet without notifying you.

So one of the causes for ERROR_CLIENT(5) on Google Glass is: not having internet connection



Related Topics



Leave a reply



Submit