I have an application that contains voice commands. I would like to access these
voice commands without pressing any button, only with a voice command .As in Chrome
("Ok google").
In Google developers in the section "adding voice capabilities", to "declare
app-providedvoice actions "explains how to define a label to start the app
but does not work me.
The app is for a mobile
Thank You
You can use the api of google
http://developer.android.com/reference/android/speech/package-summary.html
http://www.androidhive.info/2014/07/android-speech-to-text-tutorial/
and you can convert the text returned into commands
Hope that will help you
Related
I would like to know which are my posibilities as a developer to implements a send message voice action, in a messaging app (like a custom Telegram app), for spanish users. I want to implement the send new message action, I does not interested in replying to received messages (this is already implemented).
This is an example of I want to implements:
Create Message action
The user tells an utterance like "I would like to send a message with whatsapp".
A widget asks for a contact to send the message (if the user did not especificated one).
The app sends the message.
This is the same working example for spanish language: Create Message action (spanish)
I already know that there are built-in intents but the CREATE_MESSAGE built-in intent is only available for en-us locale. I also checked the custom intents but there are also only availables for en-us locale as I know. Which more options do I have?
PD: My final goal is to make the app compatible for Android Auto so I'm making it compatible with google assistant first.
Thanks in advance.
As you note, the actions.intent.CREATE_MESSAGE BII is only available in en-US right now. This is probably the best one, since it provides getting and sending a message without any additional work.
You may want to see if actions.intent.OPEN_APP_FEATURE will work for your needs. It has the downside that it does not have the fields available in CREATE_MESSAGE, but it might be a useful way to open the app.
However...
If you're planning on targeting Android Auto, that platform is even more restricted. If you're building an Android Auto app, you are limited to use only the actions.intent.GET_PARKING_FACILITY or actions.intent.GET_CHARGING_STATIONS BIIs. If you are willing to have it return a widget, you get a little more flexibility in what BIIs it accepts, but these don't let you send a message or open the app (even in en-US).
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.
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.
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
Is it possible to start Google Assistant / Now programmatically with a string parameter and make it output voice?
E.g., start it by passing the string "what's the weather" as a parameter and make it respond by voice "the weather is ...".
I'm not sure what you mean, but you can try API.AI (https://api.ai/). It's web based easy platform. Tutorial video can be found here: https://youtu.be/9SUAuy9OJg4. There are other platforms too like Node.js
More information in https://developers.google.com/actions/.
I hope this helps you.