Google Assistant Actions - android

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

Related

How to "Deep Link" into my application from Google Actions

I am investigating Google Assistant/Actions on my smartphone and Google Mini smart speaker.
I can open my application OK, however I would like to be able to "Deep Link" into specific activities within my app.
Within in the Actions Console -> DialogFlow I've discovered the pre built App Management Agents
Create Action -> Custom Intent -> App Management
App Management
Manage your applications, user controlled settings, and preferences
These look good candidates for my use case
However I cannot see how to perform the desired Deep Linking into my app.
Is it not possible to create a Google App action that navigates to an "Inner" application Activity?
I have found this site
and attempted to use this code as my "Webhook" but it fails with WebHook error (206) This code looks exactly like what I am after. How do I get it to work though?
You can use Google firebase dynamic link library. you will also get code using this link
https://firebase.google.com/docs/dynamic-links/
Let me know if you face any issue.

Launch my app from Google assistant if it is capable

The requirement is to launch my Android app if the user commands GA to find nearby restaurants of McDonald' where McDonald is the app name. Since the user is not mentioning that s/he wants to search in McDonald app it is not an explicit intent which the app can handle with a defined intent filter. I want to understand which component should I use to get this done.
There will be another use case that user wants to order some food item that has the name, McDonald. This suggests that ideally, I have to define action sets(set of templates) although the app doesn't converse with the user hence DialogFlow is not usable.
I contacted the Google action team after going through this Question, their response was that Invoking an Android application from an AOG app is not an available feature at this moment, this could be achieved using Google Assistant
What is the option left for this use-case?
My findings
Open app with Explicit intent
Perhaps the same use-case
Voice action
You will want to sign up for the app actions developer preview, which will expose intents in your app to be opened from the Assistant.
At Google I/O 2019, some updates were posted about App Actions. However, the current developer launch does not include the ability to implicitly call through to an app. The user will need to explicitly call out the app to use.
Official documentation
Google I/O 2019 session on App Actions (video)
Sample application on github

How do I use Google assistant to trigger my application

I am trying to build a simple app which can be triggered by google assistant.
Like if the users say, "Hey Google, Open TestApp" or "Hey Google, perform xyz from TestApp".
What would be the best approach? Dialogflow?
Saying "Okay, Google - do [something] with [your app]" in order to open your app to fulfill a query is called a Google Voice Action and you can add these to your app quite easily. See the documentation here for full details. Keep in mind - for these to work, your app does need to be in the Play Store, uploaded as a beta at the very least.
The Google Assistant is a little bit different - it's more conversational and doesn't take the user directly to your app. Instead, it takes the user's input, looks for the appropriate app to handle the query, feeds the query to your app, and then returns the response, within Google Assistant itself. This is all about having a conversation with an app, from the Google Assistant, without actually opening up your app.

Use Google Assistant to directly talk to my Android app and execute a very simple task

I am working on a project to integrate the Google Assistant with an existing Android app. The requirements are simple. Assuming my app is named TestApp and I want it to just change the background color of the app home page, I want to be able to say,
"Hey Google, Change background to black on TestApp".
I was given links to ActionsSDK, but looking into it, I see that it is only a stand-alone app that extends Google Assistant and has nothing to do with android itself.
The closest API I found that does what I need is the Voice Interactions. This is very similar to what I need done but it only allows preset voice triggers such as "call this person..." or "set alarm at...", but cannot do "change background..." like in in my example. According to this link, custom voice actions aren't allowed.
So my question is, is it possible to directly interact with my app and have it do a very simple task?
Thanks
You may want to connect an Android app property with your Actions project to sell your digital goods in the Play store. Implement digital transactions to sell your Play store items as part of a conversation with your Action.
To connect an Android app with your Actions console project, you will first need to connect a website to your project. Follow the instructions provided above in Connecting a website.
Once you've connected a website, under Android app, click the Connect App button and follow the instructions shown. Once you have completed the instructions over in the Play console, it may take up to 24hrs before the connected Android app is reflected in the Actions console.
Try this in Action on google
Right now there is no way to do communication between Android App and Google Assistant. If your GA is built upon Dialogflow API (specifically not using action-on-google), then you can use Dialogflow Android client in your Android App to communicate with Dialogflow Agent.
I wrote an app for my own use to brighten the screen when I was in bright sunshine and could not see the screen by asking the assistant to launch the app. Then on launch I executed code to make the change. A cheesy work-around I know :-)
you can try using this
[1]: https://docs.slanglabs.in/slang/
This will allow you to perform several actions through voice inside your app. You can use the console to add actions and utterances and there are some sample apps which might help you.
I have used it in a lot of my apps.
Feel free to reach out in case you need help, good luck!

Not able integrate deferred deep link in android app

Objective : I have 2 apps (Say A & B).
Case 1:
When app B is installed and I launch a page (say product page) on app A it will land to same product page of app B.
Case 2:
When app B is not present and I launched it from app A it will land to play store and and after installing it will open the same launched page of app A in app B.
I have followed https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder
but unfortunately didn't get any success.
I want to create it without any third party library like branch/facebook etc.
Please suggest something.
What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).
Unfortunately there's no native way to accomplish this on either iOS or Android. The Google Play INSTALL_REFERRER could work in theory, but it's unreliable and often gets delivered too late (i.e., seconds to minutes of waiting) to provide a good UX. URL schemes don't work, because they always fail with an error if the app isn't installed. Universal Links in iOS 9+ and App Links on Android 6+ at least don't trigger an error if the app isn't installed, but you'd still have to handle redirecting the user from your website to the App Store. You still can't pass context through to the app after install with Universal Links and App Links, so you wouldn't be able to send the user to the correct item.
To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do. Free services like Branch.io (full disclosure: they're so awesome I work with them) and Firebase Dynamic Links exist precisely to handle all of this for you, and we have a number of partners who build app-to-app connections like this.
I'd love to hear any feedback on why you are hesitant to use a third-party library!

Categories

Resources