Skip to content

Instantly share code, notes, and snippets.

@raveeshbhalla
Last active June 5, 2017 21:22
Show Gist options
  • Save raveeshbhalla/186325d1bb25d13bd7a0 to your computer and use it in GitHub Desktop.
Save raveeshbhalla/186325d1bb25d13bd7a0 to your computer and use it in GitHub Desktop.
How to integrate Google Now into your app (for a quick demo, view: https://www.youtube.com/watch?v=_UBvl_edu1o)
<activity
android:name=".SearchActivity">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
/**
* Somewhere in your activity
*/
String query = "";
if (getIntent().getAction() != null && getIntent().getAction().equals("com.google.android.gms.actions.SEARCH_ACTION")) {
query = getIntent().getStringExtra(SearchManager.QUERY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment