Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Extend Google Now Voice Commands in Android with Custom Actions

I recently installed the Google Now Launcher on my Nexus 4, and it got me thinking about how I could use it to interact with my own apps. While I can open my app by asking for it by title, I was wondering if there's a way to intercept the voice commands (possibly through a broadcast receiver) so I can say something like "turn off living room light" to send a signal to an Arduino to turn off the light in a room across the house? On the same note, I haven't been able to find the documentation for Google Now, so if that's out there I would love to see the link for it so I can just read what's available from the source.

like image 315
Paul Ruiz Avatar asked Nov 02 '22 04:11

Paul Ruiz


1 Answers

Yes. You can do it using the Android-Intent model. Google Now fires various intents after parsing your command, and if the phone has an app registered to handle such intent, google now will who user the options to execute the command. Common Intents are: Alarm, Fitness, Media https://developer.android.com/guide/components/intents-common.html#Now

like image 175
Sid Sarasvati Avatar answered Nov 14 '22 08:11

Sid Sarasvati