1

I want to start Google Assistant with a specific command interaction from my app.

I tried:

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.setClassName("com.google.android.googlequicksearchbox", "com.google.android.googlequicksearchbox.SearchActivity");
intent.putExtra(SearchManager.QUERY, "my command");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

It shows a web search result on google web. It is not the result what I want.

And I also tried:

Intent intent = new Intent(Intent.ACTION_VOICE_COMMAND);
intent.putExtra(SearchManager.QUERY, "my command");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

From the above code, Google Assistant is started and ready for user voice command. "my command" dose not work.

.

Expected result with the above code:

If 'my command' is "what time is it now?", the current time should be shown on the screen.

The action should be same as when user call Google Assistant with "what time is it now?".

Referred: Sending commands to Google Assistant from Android app

Any ideas?

qwerty
  • 11
  • 2

1 Answers1

-1

Set up and manage apps for the Google Assistant at Google support