Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Intent for custom voice action

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.

like image 279
bugfixr Avatar asked Nov 18 '11 16:11

bugfixr


People also ask

What is intent in voice Assistant?

An intent is a task or an action that a user requests to be fulfilled by a voice application. An intent can span multiple dialog steps and responses to be fulfilled.

What is startActivity?

Starting activities or services. To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent.

What is custom intent in Android?

Custom intents also have intent parameters, which you can map to parameters in your corresponding fulfillment. Unlike BIIs, custom intents require query patterns to describe example queries that a user might say. This approach differs from built-in intents, which each model common ways that users express that intent.

What triggers an intent in Android?

Android Intent is the message that is passed between components such as activities, content providers, broadcast receivers, services etc. It is generally used with startActivity() method to invoke activity, broadcast receivers etc. The dictionary meaning of intent is intention or purpose.


1 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.
like image 133
Yury Avatar answered Sep 21 '22 21:09

Yury