Android SpeechRecognizer set recognize engine?

2019-04-13 15:53发布

问题:

I'm using SpeechRecognizer to convert speech to text. I'm using Samsung and I encounterd error while I set Voice recognizer to 'Samsung powered by Vlingo', after I changed to 'Google' and the error disappear. I was wondering is there any method to change recognize engine programmatically? Thanks.

回答1:

I've found the answer of my question. I can use 'public static SpeechRecognizer createSpeechRecognizer (Context context, ComponentName serviceComponent)' the method to choose which recognition service to bind.

Here is the implementation.

SpeechRecognizer.createSpeechRecognizer(mContext, ComponentName.unflattenFromString("com.google.android.googlequicksearchbox/com.google.android.voicesearch.serviceapi.GoogleRecognitionService"));

Thank you all.