How to start Google Assistant programmatically?

Chop Labalagun picture Chop Labalagun · Nov 20, 2016 · Viewed 8.1k times · Source

I have tried every simple combo I have found but not sure how to do this. I even tried to simulate the home long press but you get google now voice, lookint at logcat it shows this

com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity

but not sure if this is what I am looking for or how to replicate it.

Answer

yausername picture yausername · Apr 29, 2017

This works:

startActivity(new Intent(Intent.ACTION_VOICE_COMMAND).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));