简体   繁体   中英

Run Google Assistant Command with an Android App

I want to be creating an Android App that could ask assistant to do something like, "Turn the TV on".

Google Home's Routine comes with it's own limitations, I am thinking of implementing the same with an app of my own. I tried going through the Google Assistant API but couldn't see anything that would allow app to send command just like a user does .

Could there be any possible way to make Google Assistant take command from an android app?

Edit: I want to be hard coding the command as text in code itself. Or, achieve a similar behavior somehow.

You can open like below and whatever you can speak it will reply accordingly.

   val launchIntent = Intent(Intent.ACTION_VOICE_COMMAND)
                      .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
   startActivity(launchIntent)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM