Home » Android » Android – Intent for custom voice action

Android – Intent for custom voice action

Posted by: admin June 15, 2020 Leave a comment

Questions:

When I use google voice search, I can say “Send Text” and google will launch my SMS program.

I can say “Listen to” and google will start my default music app.

Is it possible for my app to register it’s own “special phrase” such as: “MyApp DoSomething” and then have google launch MyApp with the “DoSomething” as a type of parameter I can capture and do something with?

To be a little bit more clear – I’m aware that the user can launch MyApp, then I can provide an action that starts the Voice Input, but I’d like the google voice search app to be able to start my application when certain key phrases are spoken.

How to&Answers:

As I understand you want Google Voice Search application to launch your application when you say a special key phrase. I think that at the present moment there is no possibility to add your functionality in the Google Voice Search application (there is no API for this).

However, you can implement your own Voice Search application in the following way:

  1. You can create an AppWidget and put it on the desktop.
  2. When a user click on this AppWidget you can call your service and
    from this service launch voice recognition activity.
  3. This activity will return the result of the recognition
    (http://developer.android.com/resources/articles/speech-input.html)
    which can be processed in the service. During this you can compare a
    result of the recognition with yours predefined strings for
    application launching and if there is a match then you can simply
    call needed application.