Start Google Assistant / Now with text search query - android

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.

Related

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.

Android - Pass data from link to app when installed and launched

I want to implement an app invitation, which I can share to users via a link
Hi, you've been invited to so and so. Click here to accept!
http://myapp.com/?foo1=bar1&foo2=bar2
The link itself will redirect to the google play store, but I want to keep the foo1 = bar1, foo2 = bar2. And when the application has been launched, I want to get that data and do something with it.
Is this at all possible?
If there's not, is there another way that I could go about this?
Thanks!
You could use the Google Play referrer API. There is a a library, the Play Install Referrer Library which wraps this in a slightly easier to use interface.
getting data from the download url
`https://play.google.com/store/apps/details?id=com.example.myapp&referrer=utm_content%3Dgroup232`
after first install, get the referrer and its content (eg. get "group232")
Check here for more details
https://developer.android.com/google/play/installreferrer/library

APP URI for app Indexing an android app

I have an android application. I want to implement App Indexing for my App.
I have followed the Google developer links
https://developers.google.com/app-indexing/android/publish
https://developers.google.com/app-indexing/reference/deeplinks
https://developer.android.com/training/app-indexing/deep-linking.html
https://support.google.com/googleplay/android-developer/answer/6041489
I got to know few things from the links
I need to verify my website
Use app indexing API in my Activity
The things that I did not understand
What is the website should I verify?
what should I give for APP_URI & WEB_URL?
static final Uri APP_URI = Uri.parse("android-app://com.example.android.recipes/http/recipe-app.com/recipes");
static final Uri WEB_URL = Uri.parse("http://recipe-app.com/recipes/");
What is the Schema to host my links?
android-app://{package_name}/{scheme}/{host_path}
What is the 'data' should I give in Manifest file.
Think I'm very New to to android development. Any examples are most helpful. Thanks in Advance.
So you already started well using Google's provided example to better understand how App-Indexing works. With that covered, I'd recommend you to follow also the best pratices present here:
https://developer.android.com/training/app-indexing/index.html .
Now, answering to your points:
1- As you saw with Google's example, it is required that your App has corresponding content on the web that has also been indexed by Google. In this case, the website is:
http://recipe-app.com
It would be best if you verify both the app & the website. Information on how to associate your website to your App is present in https://developers.google.com/app-indexing/android/publish
Currently App-Indexing only supports Apps that have correspondent websites. However, if you don't have a website you can still show your interest in support App-Indexing in your App by submitting this form https://developers.google.com/app-indexing/app-only .
2- Google advises to use the App-Indexing API and the HTTP intent scheme as best practices, so in this case you will only need the APP_URI. Also with this kind of implementation, you would not need to make any change on the website markup or sitemap. So in each of your App page you should indicate the APP_URI with the URI of the correspondent content in your website.
3- Assuming you're using the HTTP scheme, your deep link would be similar to this:
android-app://my.app.apk/http/mywebsite.com/sub-domain/content1.html
4- The data parameter on your app's manifest file is where you define the deep link intents that your app supports, so using the example of deep link I provided on 3), it should be similar to this:
<data android:scheme="http"
android:host="mywebsite.com"
android:pathPrefix="/sub-domain" />
This intent will support any web URL that start by:
http://mywebsite.com/sub-domain/
Hope this helps.
I think it would be better as follow:
android-app://my.app.apk/http/sub-domain.mywebsite.com/content1.html

start app with voice command

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

Can we receive the voice command converted as a string in Android Wear

Can we receive the voice command converted as a string in Android Wear? Or do we get the array of microphone amplitude values?
You will get an extra reply string with the reply intent. Here is a nice short video explaining this.
You can also look at the ElizaChat sample which does that
The Android Wear system delivers your app on the handheld the message as a string extra in the Intent you specified to be used for the action.
This link is very useful: LINK
Also, the link posted by #beworker: LINK
I am answering to my question as it might be useful for others in the near future. Because, now we are entering the era of wearable computing! :)

Categories

Resources