Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query for the default SpeechRecognizer

How to find out the ComponentName of the default system speech recognizer, i.e. the one that is returned when createSpeechRecognizer(Context context) is called? (Actually, I only need to find out which input languages it supports, so if there is an answer only to that, then I'd appreciate it as well.)

The framework solves this by

String serviceComponent = Settings.Secure.getString(mContext.getContentResolver(),
                        Settings.Secure.VOICE_RECOGNITION_SERVICE);

(See the source code of SpeechRecognizer.)

However, this solution does not seem to be available to a third party app.

like image 382
Kaarel Avatar asked May 10 '15 19:05

Kaarel


People also ask

What is speech recognizer in android?

android.speech.SpeechRecognizer. This class provides access to the speech recognition service. This service allows access to the speech recognizer. Do not instantiate this class directly, instead, call SpeechRecognizer#createSpeechRecognizer(Context) , or SpeechRecognizer#createOnDeviceSpeechRecognizer(Context) .

How do you use the speech recognizer in MIT App Inventor?

The BeforeGettingText event will be triggered before speech has been received and recognized. Then the Label will display no text on the screen. The AfterGettingText event will be triggered once speech has been received and recognized. Then the Label will display the text on the screen.

What does speech recognition do?

Speech recognition, or speech-to-text, is the ability of a machine or program to identify words spoken aloud and convert them into readable text. Rudimentary speech recognition software has a limited vocabulary and may only identify words and phrases when spoken clearly.


1 Answers

However, this solution does not seem to be available to a third party app.

I assume you came to such conclusion because Settings.Secure.VOICE_RECOGNITION_SERVICE is not a public API. However, Settings.Secure.getString() requires name of the row to lookup in secure table for the second argument. So, you can simply provide the actual the name of the row you are looking for: "voice_recognition_service".

That's, you can use the same code from SpeechRecognizer with slight change:

String serviceComponent = Settings.Secure.getString(mContext.getContentResolver(),
        "voice_recognition_service");

Hope this helps.

like image 159
ozbek Avatar answered Sep 18 '22 18:09

ozbek