Instead of saying "OK Google", I would like to open Google Assistant by clicking on a button in my own app.
So when in my app that button has been clicked, the user doesn't need to say "Ok Google". They will just simply press the button, then Google Assistant will start and then they can say whatever they want to say. Is that possible?
The activity action android.intent.action.VOICE_ASSIST can be used to search on the internet for specific keywords. For example, it can be said "What's the current date?", then this page will be opened, and the current date will also be spoken. Or you can ask anything. As long as Wikipedia is first listed on Google, a brief summary of Wikipedia's content will be spoken. If there is no answer from Wikipedia or from Google itself, the entry will be searched on the search engine of Google, but there is silence.
This is how it should be used:
Intent googleAssistant = new Intent("android.intent.action.VOICE_ASSIST");
startActivity(googleAssistant);
You can also use other actions. For instance com.google.android.gms.actions.SEARCH_ACTION, if you want to search for a place or android.intent.action.SET_ALARM to set an alarm.
However, this will not be the best answer since it will not work exactly the same as Google Assistant. So the entertainment part (e.g. "Tell me a joke") cannot be used.
References
Voice Actions Guide (Google Assistant)
List of Android Actions
Related
I want to make the first suggested line for every AutoCompleteTextView be what the user has currently typed, similar to how google search bar works in smartphones. How can this be achieved?
you have to store the value that user typed in sqlite or shared preferences first.
Then you can filter the value based on user's new search...
Take a look at this link: it uses a web service to load data
http://makovkastar.github.io/blog/2014/04/12/android-autocompletetextview-with-suggestions-from-a-web-service/
I'm closing in on the ending stages of my application and ran into an unfamiliar problem. I was able to get a google search bar implemented into my application, however the search bar itself is not needed. When the user makes a selection from pre-selected items listed, I need it to send to google search engine without actually having the search bar on the application. Can anyone give me direction on this matter? Thanks you for your help
Use can just define the url like this, where X is the search.
https://www.google.se/search?q=X
You can just search directly via google REST API.
using something like this:
GET https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
heres more information:
https://developers.google.com/custom-search/json-api/v1/using_rest
Just attach whatever it is you want the user to get search results for to the end of https://www.google.com/#q=
So if you want them to search for "butts", it'd be https://www.google.com/#q=butts
Yes! you can use EditText in your activity , then you can implements as google search bar , it is all possible by using Implicit Intent
In MainActivity :
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);String urlString= editTextID.getText().toString();
intent.putExtra(SearchManager.QUERY, urkString);
startActivity(intent);
i hope its helpful for everyone!!!!
So I'm trying to implement a custom +1 button in an android app.
I have the standard PlusOneButton working - it shows the number of +1's but I can't read the number from it. And the PlusClient doesn't seem to have the ability to tell me the number. I tried Google+ REST API but it doesn't have this functionality either.
I know there's some hack that could get the number over a POST call but that already stopped working once and I can't rely on non-official stuff.
So: is there any way to get this number through the standard google-play-services.jar?
Also: is there a way to activate a hidden PlusOneButton when the user clicks my custom button? .performClick() doesn't work.
Thanks.
What is the purpose of onSearchRequested()? I am referring to here: http://developer.android.com/reference/android/app/Activity.html#onSearchRequested%28%29
The following is stated: "You can override this function to force global search, e.g. in response to a dedicated search key, or to block search entirely (by simply returning false)." Specifically, what does the bolded piece mean? Does it not mean that we are able to disable this button? I just had a heated discussion at: Android - How to disable Search button, how to implement onSearchRequested()?
As you can see, Phil is suggesting that I have to go the other route. My questions are: can JUST this function be used to disable the search button completely? Can just this function be used without having to disable this button from the dialog builder? What did google meant with the above quoted statement? Thank you for your time.
You should be able to disable the search button using it, i would think google mean that you can block someone trying to search from within your app( IE skipping a progress dialog)
but since most android phones don't come with search buttons anymore, its not a very used function.
and yes you should be able to disable it on the fly without going through the dialog builder.
Swift
I've been working with the Facebook Android SDK for the past couple days, and while I have been able to post to my wall, one thing still stumps me: How can I fill the wall post dialog with information from my app?
For example, say you had an app that recorded hiking distance. When I launched the stream.publish dialog, I would want the text area under "What's on your mind?" to say something like "[User] hiked [distance] miles" instead of being blank.
I looked through the two samples included in the SDK, but neither address this. Is there a way to do this?
Thanks in advance!
I'm assuming you publish an attachment like - parameters.putString("attachment", publishingAttachment())
To add a message, just add the following line - parameters.putString("message", messageString);