1

The sample code for VoiceRecognitionSample is using RecognizerIntent, which is starting/working ok. But when I try to use RecognitionService, and then do a .startListening() I get a weird error saying:

W: Permission Denial: Accessing service ComponentInfo{ com.google.android.libraries.assistant.soda.recognitionservice/com.google.android.libraries.assistant.soda.recognitionservice.SodaRecognitionService} from pid=5150, uid=10076 requires com.google.android.libraries.assistant.soda.recognitionservice.USE_SPEECH

E: java.lang.SecurityException: Not allowed to bind to service Intent { act=android.speech.RecognitionService cmp=com.google.android.libraries.assistant.soda.recognitionservice/.SodaRecognitionService }

Full error stack:

07-05 16:49:27.534 1173 3713 W ActivityManager: Permission Denial: Accessing service ComponentInfo{com.google.android.libraries.assistant.soda.recognitionservice/com.google.android.libraries.assistant.soda.recognitionservice.SodaRecognitionService} from pid=6729, uid=10072 requires com.google.android.libraries.assistant.soda.recognitionservice.USE_SPEECH 07-05 16:49:27.538 6729 6729 E InputEventReceiver: Exception dispatching input event. 07-05 16:49:27.538 6729 6729 E MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: java.lang.SecurityException: Not allowed to bind to service Intent { act=android.speech.RecognitionService cmp=com.google.android.libraries.assistant.soda.recognitionservice/.SodaRecognitionService } 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1623) 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at android.app.ContextImpl.bindService(ContextImpl.java:1557) 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at android.content.ContextWrapper.bindService(ContextWrapper.java:684) 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at android.speech.SpeechRecognizer.startListening(SpeechRecognizer.java:288) 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at root.gast.speech.SpeechRecognizingActivity.recognizeDirectly(SpeechRecognizingActivity.java:202) 07-05 16:49:27.553 6729 6729 E MessageQueue-JNI: at com.example.glass.voicerecognitionsample.MainActivity.requestVoiceRecognition(MainActivity.java:168)

I've noticed there's something going on with the Google Voice Typing (in settings->languages->virtual keyboard) because it fails to open and show the configuration, so maybe it's missing some libraries to be able to work, but maybe I'm just missing some permission in my manifest. I couldn't find anything related to SodaRecognitionService and/or the requires com.google.android.libraries.assistant.soda.recognitionservice.USE_SPEECH permission.

(I'm using google glass enterprise edition 2, with the latest image OPM1.200313.001) The same code works fine in a cellphone with android 8.1, it's something specific to the glass.

Any clues/ideas? Thanks!!

Natalia
  • 21
  • 2

1 Answers1

0

while digging into the Google Glass EE2 documentation i found this

Binding to the SpeechRecognizer service is not allowed, therefore the SpeechRecognizer#startListening() method will not work.

Source: Google Glass EE2 - Inputs and Sensors

I'm running system image version OPM1.200625.001 on my Google Glass Enterprise Edition 2 and the quote above is still true.

The only way to make speech recognition work natively is the one explained in the documentation page i linked, below there is a snippet to let you better understand what part of the page i'm referring to

  1. Call startActivityForResult() with the ACTION_RECOGNIZE_SPEECH intent. The following intent extras are supported when starting the activity: ...