Developers can add “OK Google” support with only 6 lines of code

One of the best upcoming features of Android is the handsfree “OK Google” voice activation and Google has posted a cheat sheet on how to bring the voice search to your App.

All it takes is a small addition to the AndroidManifest.xml in order to connect to Google Now using the following code:

<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>

Once implemented, users can simply say “Ok Google, search Pizza on Eat24”.

So if you’re a developer, drop us a comment below – did you think it was this quick to add “Ok Google” support?

Loading...