Search code examples
androidspeech-recognitionandroid-4.2-jelly-bean

How to programmatically override "Google Voice Search" over "Samsung powered by Vlingo"?


Some devices (like Samsung Galaxy S3) come pre-installed with Samsung powered by Vlingo instead of Google Voice Search.

In my app, I would like to programmatically override which speech recognition engine to use, so that Google Voice Search is always used by my app.

So my questions are:

  1. Is there a way to tell which speech recognition engines are installed? (If so, how?)
  2. Is there a way to tell which speech recognition engine is selected in the user settings? (If so, how?)
  3. Is there a programmatic way to override user's selection, so that my app always invokes Google Voice Search? (if so , how?)

Help will be appreciated


Solution

  • The answer to all your questions is "yes".

    createSpeechRecognizer can be given the package name of the recognizer to use. So if you know the package name then you can override the default.

    To detect the available services, use:

    List<ResolveInfo> services =
        getPackageManager().queryIntentServices(
            new Intent(RecognitionService.SERVICE_INTERFACE), 0);
    

    For more details study the source code of Babble. I don't know if this is the best way to do it (any feedback is welcome) but it has worked on my devices. (Babble in general assumes Android 4+, but the speech recognizer detection part might also work on earlier versions.)