Pro tip: Use Google Now to launch your next Android app

Here's how to harness the power of Google Now in your Android app -- without writing Java code -- by letting users launch your app using voice commands.

Google Now Launcher on a Nexus 7 device.

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.

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android=""
    android:label="My Voice Activated App" >

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

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    package="com.authorwjf.myvoiceactivatedapp" >

        android:theme="@style/AppTheme" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.SEARCH" />
            <meta-data android:name=""
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


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.

By William J. Francis

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...