Add Google Assistant routines from my app - android

I'm trying to develop an interactive "allspeech-based" application and I have found some troubles.
I would be able to do every task of my app without the touch input, only the voice one.
So, my idea was to use Google Assitant to open my app, and then execute tasks with Activities "allspeech-based". My only problem is open my app with a custom phrase like "Hello myApp".
I've noticed that Google only permit to define in Manifest in which developer can set predefined method like SEARCH_ACTION (I have to say "Serch cats in myAPP..."), ... and not custom action!
Then I had an idea: to resolve this I can define a new routine in my Google Assistant where Command is "Hello myApp" and action is "Open myApp", and it works!
But I don't want to force my users to add a new tourine in their Assistant, I want to do it from my app automatically at the first opening of my app (throught an Intent and a startActivity or something similar idk).
My question is: How can I do? Which Intent I have to invoke? With which extras? Is it possible?
Please answer, thank you.

There's no such intent which can directly create a new routine.

Related

Flutter Huawei App Linking get info from link

i have implemented AppLinkin in my flutter app, and it works good, but i want to avoid the behaviour to open a new app instace
In android i'm using singleTask in launchMode
Also using this package app_links to handle the link each time the user tap the link. but I only get the link, without the info, like this: https://myApp.drcn.agconnect.link/linkId
I want to know if exist a way to get the info from the link, knowing that the api is already released
As confirmed by the team, the getAppLinking function is not supported in the singleTask launch mode. Currently, only the standard launch mode is supported.
For details, you could refer to this Docs :

I want to be able to say, "Hey Google, Create a meeting on TestApp" is this possible without opening the application

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 Create a meeting, I want to be able to say, "Hey Google, Create a meeting on TestApp".
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 "create a task or something else..." like 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?
Short Answer: No, not directly. But your Action can be made to prompt the user for permission to "deep-link" into an Android activity. To do that you need first to associate the Action and the Activity in the console. Sample code is here
https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation_helper.deeplink.html
Longer Answer: Before there were Actions on Google there were Google Now Actions. (Yeah I know it's confusing). With Google Now Actions the Google App on a phone can be made to launch an Android activity with an intent which carries search terms in the bundle of "string extras". Then your user would say something like
"OK, Google search for the meeting creator on TestApp". Then you would get the text "the meeting creator" as a query string extra in a specially crafted search intent which launches TestApp into its meeting-creating activity. Details are here:
https://www.seroundtable.com/google-now-actions-19436.html
Unlike Actions on Google, Google Now Actions forces your user to pose his request as a search.

Google Assistant Voice Interaction Open Command

Is there any reliable way to check if my activity was started from the Google Assistant (with the Start/Open command) or from the launcher icon?
The documentation about the Open command states
(Works by default; no specific intent.)
so i'm not totaly optimistic.
I found following difference when debugging app if its start by Google Assistant Voice Interaction Open Command
when it is start by Google Assistant Voice Interaction Open Command
you will get "android.intent.extra.REFERRER_NAME" contain key in getIntent().getExtras()
getIntent().getExtras().containsKey("android.intent.extra.REFERRER_NAME")
if(getIntent().getExtras()!= null && getIntent().getExtras().containsKey("android.intent.extra.REFERRER_NAME")){
Log.e(TAG, "onCreate: From Voice assistance");
}else{
Log.e(TAG, "onCreate: Not From Voice assistance");
}
but if it start from menu, you will not get that key.
May be this can solve your problem.
The short answer: Actually NO
The default voice command: Open XYZ where XYZ is the name of an application, actually doesn't have any information attached to let you know that the request has been processed by the Google Assistant.
As I already told you, probably this is done to prevent developers to attach behaviours that users could not expect from the open command which should simply open the app and nothing else.
Note: If the user specifies additional commands, for example Open XYZ and play ABC song this results in a custom intent which you can get with getAction() in your onCreate() method as described here but this is not your specific case.
References: https://developers.google.com/voice-actions/system/#open_actions

get results from google maps intent

in my android application I want the user will be able to choose some location and to get this location back to the application code.
something like startActivityForResults.
Does it's possible?
I know that it is possible with all the google service sdk and all of this,
but I want to use only the content intent, like described here:
https://developers.google.com/maps/documentation/android-api/intents#overview
and here (in the maps section):
http://developer.android.com/guide/components/intents-common.html
thanks a lot.
There is no requirement for an Android device to have an app that does what you want. There is no standard Intent structure for this, either.

Leaving feedback in the market for application does not work

I had made one application and it was OK, but didn't provide the feedback option to the users. Now I made another app and trying to put feedback option - leaving feedback for the app thing from the mobile itself.
I checked the following link for the help and used the same code to put in my app:
How to launch the Google Play intent in 'Give Feedback' mode on Android?
String pkgnm = getPackageName();
Intent mktfdbk = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pkgnm));
mktfdbk.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(mktfdbk);
My app is using an AlertDialog where user would click on "YES" to possibly leave the feedback on market.
Obviously at the moment my app is not in the market it wont show up anything even if using above code... but seeing the code and just for testing purpose I changed the package name to my previous app which I created and is still in the market.
But when executing the above code, it tries to connect to internet and then says "The requested item could not be found". Internet access is there, I have also used uses-permission for internet (not even sure if that was needed but I put it anyways). What am I doing wrong?

Categories

Resources