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.
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) .
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With