简体   繁体   中英

Google Assistant Actions

I am trying to use the Google Assistant to launch an activity of my Android app with a specific parameter. I have read this:

https://codelabs.developers.google.com/codelabs/actions-1/#0 https://developers.google.com/assistant/app/action-schema https://developers.google.com/assistant/app/get-started

But I am confused, completely lost. From my point of view, everything looks messy and confused.

In the Actions Console I have created one Action Project called "Actions Project for my app". Then I went to the DialogFlow console and modified the Default Welcome Intent and created some other intent. Both were tested using the testing option "See how it works in Google Assistant." It worked well doing those testings.

Then, in another site I read that I have to create an Action.xml file in my app project in Android studio. But how do I have to do that? Do I have to "export" my project "Actions Project for my app" to some xml file? I think that documentation is not enough for clumsy people like me. I don't really know the next step. I am really struggling with this.

Basically I want the assistant to let the user say something, then pass that information to my app, do somework and then execute an activity to do something. For example, if we are talking about MyCookingApp I want this:

User: Ok Google, talk to MyCookingApp
Assistant: Welcome to MyCookingApp, what do you want to cook?
User: Pizza

Assistant should open my app with the parameter "Pizza". My app should display an activity with a pizza image and the recepie for it.

Is all this possible?

Connecting your serverside Action to your Android app is not directly feasible. Actions on Google is available on a variety of surfaces beyond Android, so you can't necessarily expect the Action to immediately launch your app. However, there are a few ways to get the behavior that you want:

  • Make your response include a BasicCard which has a link to deep link into your app
  • Look at using App Actions to achieve the behavior you want, which is designed for the Assistant to link into Android apps
  • From your Action's webhook, send a push notification to the user's phone (assuming you have account linking setup) to your app to open it up

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