Let’s face it: Google Now is so cool. I remember working on an application 10 years ago that had “voice recognition.” The room needed to be entirely quiet, you had to annunciate like a Speak & Spell, and just maybe, if you shouted at the speed of paint drying, the underlying algorithm had a fifty-fifty shot at understanding what you were trying to tell it.

Google Now, on the other hand, not only almost always gets it right, but also manages to do so in a crowded restaurant when others are talking and music is blaring on the patio. Wouldn’t it be great to harness that power in your own app? Well, you can. In fact, as of JellyBean you can let users launch your app using voice commands without writing any Java code. This tutorial will teach you how.

Follow along using the step-by-step instructions below, or download and import the entire project directly into Android Studio.

1. Create a new Android project in Android Studio. Be sure to target JellyBean (API 19) or better.

2. In the /res folder, create a new directory called /xml. Add a file to the newly created directory titled searchable.xml. Use the label node in searchable.xml to call out your app by name.


3. In the /manifests/AndroidManifest.xml file, add a searchable intent and metadata to your main activity.

Now you’re ready to give it a go! Enable Google Now everywhere on your device, if you haven’t already. Load the app to your device, and then exit the app or push it to the background. Say: “Okay Google, start my voice activated app.” Providing everything went according to plan, your app should launch.

Congratulations — you’ve harnessed the power of Google Now.