androidandroid-intentgoogle-now

How can I launch GoogleNow by an Intent with adding a search query?


I want to start GoogleNow by an Intent and add a search query as an extra (putExtra()) which should be executed in the GoogleNow search engine.

Till now I only used:

Intent intent = new Intent(Intent.ACTION_ASSIST);       
startActivity(intent);

This just causes GoogleNow to open - but how can I add the search string?

Br


Solution

  • So none of this is official, but you can launch Google Now with a query like this:

        final Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.setPackage("com.google.android.googlequicksearchbox");
        intent.putExtra(SearchManager.QUERY, "Your query");
        startActivity(intent);