Google has historically been referred to as “the search giant” which is becoming more and more irrelevant as the firm expands into huge standalone products such as Android. Now the web giant wants to bring their search expertise, and the world’s most popular OS, closer together.
On the Android Developer Blog, Google has announced the ability to allow Android’s on-device search to open and scour your application for data with just six-lines of code in your AndroidManifest.xml file…
The lines you will need to add are:
<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>
Simple, right? And the functionality this enables is quite impressive, a user could say something like “Search TripAdvisor for Pizza Restaurants” and TripAdvisor will be opened and the search field filled with the data which is being requested.
Here it is in action:
Once you make these changes, your app can receive the SEARCH_ACTION intent containing the SearchManager.QUERY with the search expression. After developers integrate the code, any user running Google 3.5 or higher on an Android Jelly Bean+ device will be able to take advantage of the functionality.
Better still, with hotword functionality users don’t even have to close their current application. All they have to do is say “Ok, Google” (unless changed) and make their request. From a development perspective, it’s an easy way to add powerful functionality. From a user perspective, it offers a seamless method of deeper-interaction with their applications.
Will you be allowing users to search your apps? Let us know in the comments.