Google Allows Search Queries To Interact With Apps

Google Allows Search Queries To Interact With Apps

We may earn a commission for purchases made using our links.

Android 5.0 Lollipop brings lots of new features that are quite useful for end users and developers. In the interview with Google execs we talked about earlier, they talked about making integration with Ok Google a bit easier. As promised, Google has now provided a method to use the search with external applications.

The solution comes in just six lines of code that can be added to the AndroidManifest.xml file in your app. After adding it, users will be able to say, for example “Ok Google. Search for pizza on Eat24.” This command will search for the term pizza in the Eat24 application. Here’s the required 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>

Allowing developers to use “Ok Google” functionality is definitely a step in the right direction. New devices like Google Nexus 6 have dedicated hardware to detect voice, so developers will be able to take advantage of this functionality. For now, this will work only on devices set to English locale running Jelly Bean or above.

[Source: Android Developers Blog]