AppsNews

Devs: “OK Google” search command works with any app with 6 quick lines of code

8

okay-google-android

Google has just publicized an awesome feature for developers who want their apps to be searchable using the “OK Google” voice command. Putting 6 simple lines of code in your manifest file will enable Google Search to allow voice searches that originate from users using the command. Here are a couple of examples:

  • Ok Google, search pizza on Eat24”
  • Ok Google, search for hotels in Maui on TripAdvisor”

And here’s the line of code you’ll need to add to the AndroidManifest.xml file:

<activity android:name=".SearchableActivity">
    <intent-filter>
        <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>

And that’s it. As long as your app has a searchable activity users can initiate the command and search like they would through Google’s own search engine (though you’ll need to be using English and have Google Search version 3.5 or higher installed on phones or tablets with Jelly Bean or higher). Can’t wait to see this make its way into many of the great apps in Google Play!

[via Google]

Quentyn Kennemer
The "Google Phone" sounded too awesome to pass up, so I bought a G1. The rest is history. And yes, I know my name isn't Wilson.

Motorola and Lenovo are officially an item

Previous article

Samsung Gear S trots over to the United States starting next week

Next article

You may also like

8 Comments

  1. I’m still waiting for voice controls over the entire phone. I want to be able to turn volume up, down, skip songs, etc. Slacker is slacking

    1. Tasker is your best bet for that. Root and buy it along with a few other apps.

    2. Kinect phone?

  2. So I am a little confused as to what this does? By adding this to my manifest, does it mean that I could for instance in my checkbook app, say “Ok Google, what are my upcoming bills” and have it then search my app and return what my bills due are? Or is this just allowing me to do a web search from within my application using the “ok google”?

    1. Honestly, I think it is just so that your app comes up when you say “Ok Google open such and such app”. I don’t see how this simple line of code could do much beyond that but I’ve been wrong before.

    2. It’s not necessarily a web search. If the app has that specific search, this will enable use of it through ‘OK Google’.

      E.g. searching for your team on a sports app. Searching for a gas station on gas buddy. Searching for a movie through Flixster/movie app. Etc.

  3. This is for app developers. You can’t just change a manifest file of any app but if you are developing an app with a search function you can enable Google voice search to automatically open your app and search it.

  4. I love using “OK Google” outside of the Google search bar. I just figured out how to activate it on my LG G2: On-Screen Phone was activated and apparently that turns off the microphone so you can’t set it up. I’m excited to see how far these voice controls will go (like the examples in the article).

Leave a reply

Your email address will not be published. Required fields are marked *

More in Apps