Professional Documents
Culture Documents
Develop
Training
Previous
Next
"Start " to use these voice actions and an activity that you specify starts.
say what they want to do and let the system figure out the best activity to start.
When users speak the voice action, your app can filter for the intent that is fired to start an activity. If you want to start a service to do something in the
background, show an activity as a visual cue and start the service in the activity. Make sure to call finish()when you want to get rid of the visual cue.
For example, for the "Take a note" command, declare this intent filter to start an activity named MyNoteActivity:
<activity android:name="MyNoteActivity">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="com.google.android.voicesearch.SELF_NOTE" />
</intent-filter>
</activity>
Example Phrases
Call a
car/taxi
taxi"
"OK Google, call me a
Intent
Action
com.google.android.gms.actions.RESERVE_TAXI_RESERVATION
car"
Take a note
android.intent.action.SEND
Category
com.google.android.voicesearch.SELF_NOTE
Extras
android.content.Intent.EXTRA_TEXT- a string with note body
Set alarm
Action
android.intent.action.SET_ALARM
Extras
android.provider.AlarmClock.EXTRA_HOUR- an integer with the hour of the alarm.
android.provider.AlarmClock.EXTRA_MINUTES- an integer with the minute of the alarm
Action
android.intent.action.SET_TIMER
Extras
android.provider.AlarmClock.EXTRA_LENGTH- an integer in the range of 1 to 86400
stopwatch
stopwatch"
Action
com.google.android.wearable.action.STOPWATCH
Start/Stop
a bike ride
vnd.google.fitness.TRACK
ride"
Mime Type
"OK Google, stop cycling"
vnd.google.fitness.activity/biking
Extras
actionStatus- a string with the value ActiveActionStatuswhen starting and
CompletedActionStatuswhen stopping.
Start/Stop
a run
Action
"OK Google, start
vnd.google.fitness.TRACK
running"
"OK Google, stop
MimeType
running"
vnd.google.fitness.activity/running
Extras
actionStatus- a string with the value ActiveActionStatuswhen starting and
CompletedActionStatuswhen stopping
Start/Stop
a workout
workout"
"OK Google, track my
workout"
Action
vnd.google.fitness.TRACK
MimeType
vnd.google.fitness.activity/other
workout"
Extras
actionStatus- a string with the value ActiveActionStatuswhen starting and
CompletedActionStatuswhen stopping
Show heart
rate
heart rate?"
"OK Google, whats my
bpm?"
Action
vnd.google.fitness.VIEW
Mime Type
vnd.google.fitness.data_type/com.google.heart_rate.bpm
Show step
count
Action
vnd.google.fitness.VIEW
Mime Type
vnd.google.fitness.data_type/com.google.step_count.cumulative
For documentation on registering for platform intents and accessing the extras information contained in them, see Common intents.
Search
Previous
Next
Blog Support
Except as noted, this content is licensed under Creative Commons Attribution 2.5. For details and restrictions, see the Content License.
English