Phandroid
Devs: “OK Google” search command works with any app with 6 quick lines of code
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]
0 comments:
Post a Comment