0

I've searched Google and the Internet for information on how to do this but I can't find anything.

Does anybody know if it's possible to launch Google Now on a button click in my Android App?

I know how to launch a normal application by using the package manager but I can't seem to figure out how to launch this.

Alex Riley
  • 169,130
  • 45
  • 262
  • 238
user1353517
  • 300
  • 3
  • 10
  • 28
  • is this what you want? http://stackoverflow.com/questions/18049157/how-to-programmatically-initiate-a-google-now-voice-search – denvercoder9 Mar 04 '15 at 23:46
  • @RafiduzzamanSonnet No, this is what I'm wanting to launch http://img.talkandroid.com/uploads/2012/11/Screenshot_2012-11-01-01-30-46.png – user1353517 Mar 04 '15 at 23:49
  • the google now launcher must be installed. Do the following: Intent intent = new Intent("com.google.android.launcher"); – denvercoder9 Mar 05 '15 at 00:01
  • I'm not wanting to launch the google now launcher. I'm wanting to launch Google Now. http://en.wikipedia.org/wiki/Google_Now – user1353517 Mar 05 '15 at 00:12
  • Can't you just launch this: https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox ? – Morrison Chang Mar 05 '15 at 02:13
  • @MorrisonChang I've tried that and it only brings up voice search when you call that package – user1353517 Mar 05 '15 at 09:41

1 Answers1

0

This code snippet calls the intent Google Now is listening for.

    Intent intent= new Intent("android.intent.action.ASSIST");
    startActivityForResult(intent,1);

The whole thing would look like this:

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final Button button = (Button) findViewById(R.id.yourButtonID);
        //Test button
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                        Intent intent= new Intent("android.intent.action.ASSIST");
                        startActivityForResult(intent,1);
            }
        });
    }

}

Ari
  • 1,361
  • 1
  • 15
  • 23