0

I am relatively new to android and I am working on an app which requires me to open google assistant from my own application. I do not intend to add conversations and my sole purpose is to mimic the "Home Button Long Press" which opens up Google Assistant. Any way I can do that? Thanks!

StonksMan9000
  • 321
  • 8
  • 21
  • You may want to look at this related question: https://stackoverflow.com/questions/40709191/how-to-start-google-assistant-programatically – Nick Felker Mar 02 '18 at 22:07
  • Possible duplicate of [How to start Google Assistant programatically?](https://stackoverflow.com/questions/40709191/how-to-start-google-assistant-programatically) – Gokul Nath KP Mar 05 '18 at 08:39

3 Answers3

0

You can try use this ACTION_VOICE_COMMAND that that activity action is to start Voice Command.

In your code:

startActivity(new Intent(Intent.ACTION_VOICE_COMMAND)
    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
Gokul Nath KP
  • 15,485
  • 24
  • 88
  • 126
0

Try this one.. It works

    `$`
    startActivity(new 
  Intent(Intent.ACTION_VOICE_COMMAND).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
0
val intent = Intent(Intent.ACTION_VIEW)
intent.data=Uri.parse("market://details?id=com.google.android.apps.googleassistant")
activity.startActivity(intent)