Requires Xposed Framework!
This module adds an API to the Google Search app, commonly referred to as Google Now.
This allows developers to make plugins that react to searches done in Google Search.
As of right now, the developers cannot interact with the cards UI, not sure how feasible that is, if it is, it'll be in future versions.
(I showed this on reddit some days ago: http://www.reddit.com/r/Android/comments/1rmvxs/heres_a_preview_of_my_google_search_now_api/)
Screenshots:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Demos:
Lyrics fetching: https://www.youtube.com/watch?v=OsNCHo5JZuA
Song recognition outside US with Shazam: https://www.youtube.com/watch?v=ThbW5glU7zM
AutoVoice: http://www.youtube.com/watch?v=usjqq5hwlSE
Compatibility:
Any 4.1+ device that can run Xposed Framework. ICS not supported at the moment, not sure how recent the Google Search port is.
Download:
Please note that this is a 1.0 release, it may or may not have bugs.
http://repo.xposed.info/module/com.mohammadag.googlesearchapi
Source:
This is open source, you're free to contribute to the source, but you're in now way allowed to release this anywhere else.
https://github.com/MohammadAG/Google-Search-API
Plugins:
This doesn't do anything without plugins, which needs developer support. More on that below. Here are some fully working examples:
Music Controls: Control music playback. Supported commands: "play/pause/resume music", "play songs by <artist>", "play song <title>", "next/previous track/song", "volume up/down/max", "what song is this" opens in Shazam, requires Shazam, no idea what happens without it.
Voice Toggles: Turn on/off Wi-Fi, Mobile Data, or Bluetooth.
AZLyrics Viewer: Shows lyrics for songs from AZLyrics.com. Supported commands: "show lyrics for <song> by <artist>", exact syntax required here, artist is not optional.
Autovoice, by @joaomgcd, run Tasker commands from Google Search.
Plugin sources:
Music Controls: https://github.com/MohammadAG/GNAPI-MusicControls
Voice Toggles: https://github.com/MohammadAG/GNAPI-VoiceToggles
AZLyrics Viewer: https://github.com/MohammadAG/Android-AZLyricsViewer
Developers:
Implementing plugins is as easy as copying one file to your source, and implementing a BroadcastReceiver that listens for the search queries (sent as text). If you're implementing a UI, implement TextToSpeech for voice feedback, if not, use GoogleNowApi.speak for voice replies.
All this is demonstrated in the examples above.
You'll also need to add a permission to AndroidManifest.xml: "com.mohammadag.googlesearchapi.permission.ACCESS_GGOGLE_SEARCH_API"
Remember that any package needs one activity to be started to work, see the music controls example for a way around that.
Of course, you're free to make your plugins free/paid/whatever.
What are the two checkboxes for?
If you're using GEL, you basically need to have the first checkbox checked. This is because GEL uses an overlay for the first part of the search, then opens the usual search app without the transitions. This means that if a developer already started an activity, it'll be sent to the background cause search was started after it.
Second checkbox prevents duplicate searches, this can be useful (you'll see how), and not so useful (when you do two volume ups/downs). Experiment as needed.
Support development
This took quite a lot of research, Google Search's code is huge, if you found this useful, please consider a donation.
Downloading and trying on note 3 asap
Sent from my SM-N900T
Any way this could be made to support Tasker out of the box? Basically if it sent a broadcast intent without the need for a permission and such.
Cptnodegard said:
Any way this could be made to support Tasker out of the box? Basically if it sent a broadcast intent without the need for a permission and such.
Click to expand...
Click to collapse
It needs a permission right now, but I plan to make a Tasker plugin.
Hi MohammadAG.
What do you think about unlock Remote API? I tried to do this, but I have very limited time.
The problem is reconstruction of the API. Reverse engineering, reverse, reverse
Code:
<service android:name="com.google.android.sidekick.main.remoteservice.GoogleNowRemoteService" android:permission="com.google.android.apps.now.REMOTE_ACCESS" android:process=":search">
<intent-filter>
<action android:name="com.google.android.sidekick.shared.remoteapi.IGoogleNowRemoteService" />
</intent-filter>
</service>
In latest version require signature (after upload my module Google change it)
Code:
<permission android:label="@string/permission_remote_access_label" android:name="com.google.android.apps.now.REMOTE_ACCESS" android:protectionLevel="signature" android:description="@string/permission_remote_access_desc" />
but in android:versionCode="300207090" android:versionName="2.7.9.789824.arm" only hook function:
Code:
<permission android:label="@string/permission_remote_access_label" android:name="com.google.android.apps.now.REMOTE_ACCESS" android:protectionLevel=">>>normal<<<<" android:description="@string/permission_remote_access_desc" />
Code:
checkForValidSignature(int paramAnonymousInt)
API function is very interesting: ht tp:/ /wk le j.to/g38qK
To prevent spam on the XDA forums, ALL new users prevented from posting outside links in their messages. After approximately 10 posts, you will be able to post outside links. Thank you for understanding!
Click to expand...
Click to collapse
It requires changing the settings in teamdog "section", which makes my module. Latest version of the module in the repo does not support latest Google Search. I did fix, but not yet released. Do want it it?
Dzakus said:
Hi MohammadAG.
What do you think about unlock Remote API? I tried to do this, but I have very limited time.
The problem is reconstruction of the API. Reverse engineering, reverse, reverse
<snip>
API function is very interesting: http://wklej.to/g38qK
It requires changing the settings in teamdog "section", which makes my module. Latest version of the module in the repo does not support latest Google Search. I did fix, but not yet released. Do want it it?
Click to expand...
Click to collapse
That's actually interesting... I didn't notice that part, mainly cause I thought sidekick was the name of some Motorola device.
The fun part is CardResponse implements Parceable, so this could probably be used to do card UI responses.
PM me your module, I'll have a look at this.
The signature shouldn't be a problem, PackageManager can be hooked I guess.
2242683
MohammadAG said:
That's actually interesting... I didn't notice that part, mainly cause I thought sidekick was the name of some Motorola device.
The fun part is CardResponse implements Parceable, so this could probably be used to do card UI responses.
PM me your module, I'll have a look at this.
The signature shouldn't be a problem, PackageManager can be hooked I guess.
Click to expand...
Click to collapse
@MohammadAG, dumped from device, so signed debug key APK: http:/ /w w w12.zipp yshare. com/ v/6439333/file.html
I can not find the source code, but I still look for it tomorrow.
byte[] is for protobuf data :-/
MohammadAG said:
It needs a permission right now, but I plan to make a Tasker plugin.
Click to expand...
Click to collapse
I'm totally implementing this in AutoVoice tomorrow so no need for you to go through the trouble if you don't want to. haven't tried it but looks great!
joaomgcd said:
I'm totally implementing this in AutoVoice tomorrow so no need for you to go through the trouble if you don't want to. haven't tried it but looks great!
Click to expand...
Click to collapse
Awesome, you'd be the first dev to implement this!
If you have any comments on the API, do tell, it's the first time I've written an almost solid API.
(I image a library that can be imported would be better than copying the .java file, if that's a comment)
MohammadAG said:
Awesome, you'd be the first dev to implement this!
If you have any comments on the API, do tell, it's the first time I've written an almost solid API.
(I image a library that can be imported would be better than copying the .java file, if that's a comment)
Click to expand...
Click to collapse
Ok, here it is!
(oops, can't post a link to the youtube video... Look up my channel on youtube: joaomgcd. If you would be so kind as to post the link to the video it would be cool)
AutoVoice integration couldn't be simpler! Thank you very much for creating this!
About the API, it's fine as it is! I personally much prefer a java file like that specially since it's such a simple one. I wouldn't want to import a jar just to get access to a constant.
Of course the API could grow, but I actually like having the java file like that.
Congrats on the great API, I hope you don't mind that I linked to it in the YouTube video and in the description.
joaomgcd said:
Ok, here it is!
(oops, can't post a link to the youtube video... Look up my channel on youtube: joaomgcd. If you would be so kind as to post the link to the video it would be cool)
AutoVoice integration couldn't be simpler! Thank you very much for creating this!
About the API, it's fine as it is! I personally much prefer a java file like that specially since it's such a simple one. I wouldn't want to import a jar just to get access to a constant.
Of course the API could grow, but I actually like having the java file like that.
Congrats on the great API, I hope you don't mind that I linked to it in the YouTube video and in the description.
Click to expand...
Click to collapse
Added to first post with a link to the video, thanks!
Glad you found the API useful as is, I'll keep it as a java file till I implement card responses, then you'd probably need to use a library to create cards
joaomgcd said:
Ok, here it is!
(oops, can't post a link to the youtube video... Look up my channel on youtube: joaomgcd. If you would be so kind as to post the link to the video it would be cool)
AutoVoice integration couldn't be simpler! Thank you very much for creating this!
About the API, it's fine as it is! I personally much prefer a java file like that specially since it's such a simple one. I wouldn't want to import a jar just to get access to a constant.
Of course the API could grow, but I actually like having the java file like that.
Congrats on the great API, I hope you don't mind that I linked to it in the YouTube video and in the description.
Click to expand...
Click to collapse
Sweet! How can we do this if we don't have your rom?
And have you looked at Utter! At all? Either of you....
Anyway to integrate this?
Sent from my GT-I9505G using Tapatalk
Are supported apps supposed to show in the plugin list in the Search API app? Can't get Autovoice to work despite it being the correct version with integration enabled, the xposed plugin is also up and running. The plugin list doesnt show Autovoice however.
Cptnodegard said:
Are supported apps supposed to show in the plugin list in the Search API app? Can't get Autovoice to work despite it being the correct version with integration enabled, the xposed plugin is also up and running. The plugin list doesnt show Autovoice however.
Click to expand...
Click to collapse
it shows for me in the plugins section of google search api. what version of autovoice you have? did you reboot?
spyros.giotakis said:
it shows for me in the plugins section of google search api. what version of autovoice you have? did you reboot?
Click to expand...
Click to collapse
Yes I rebooted.
I backed up and reinstalled AutoVoice using TB, then Google Search API crashed, and then it showed up and now works
Cptnodegard said:
Yes I rebooted.
I backed up and reinstalled AutoVoice using TB, then Google Search API crashed, and then it showed up and now works
Click to expand...
Click to collapse
Lol, its great now that I dont have to use the autovoice widget anymore on my nexus 5!
Sc4ryB3ar said:
Sweet! How can we do this if we don't have your rom?
And have you looked at Utter! At all? Either of you....
Anyway to integrate this?
Sent from my GT-I9505G using Tapatalk
Click to expand...
Click to collapse
This is not ROM dependent. Simply install AutoVoice and Tasker and you're good to go.
Stupid question: is it limited to English or should it work for other languages?
MohammadAG said:
Added to first post with a link to the video, thanks!
Glad you found the API useful as is, I'll keep it as a java file till I implement card responses, then you'd probably need to use a library to create cards
Click to expand...
Click to collapse
Thanks again!
By the way, can you differentiate between text and voice searches? That would be a useful extra to have in the intent from the broadcast.
neFAST said:
Stupid question: is it limited to English or should it work for other languages?
Click to expand...
Click to collapse
Whatever Google Search recognizes is good. Yes, you can use this to implement voice commands in other languages.
joaomgcd said:
Thanks again!
By the way, can you differentiate between text and voice searches? That would be a useful extra to have in the intent from the broadcast.
Click to expand...
Click to collapse
It's already there. Boolean extra, the key is in the Java file, look at AZLyricsViewer for an example.
Hello,
I trying to develop an application for Amazfit (Pacefied).
I am using latest Android Studio, with SDK Android 5.0 Lollipop 21 rev 2 (version seen in an other post).
I just create a empty application with an empty activity, for Phone (not Wear because I heard that Wear app need some libs that are not present in watch...)
I compile it and generate an apk (for x86 platform ?!?).
I install with adb into the watch
It appears in the last screen (right) with lots of apps.
But when I click on it, nothing happens !
Do you have an idea/tip or a link for an existing project or how-to ?
Thanks, a+
Vicnet
you need to compile it for MIPS
Here's a jumpstart: https://github.com/manuel-alvarez-alvarez/malvarez-watchface
I successfuly compile and test on Amazfit a "Heelo world" app.
As I said before I use Android Studio to generate an app for android 21 (I try 23 but apk don't install).
I don't use compat module.
The main pb was the app style, based on simple ActionToolbar in the first version, that not working (app dont launch).
I change in style.xml the parent style to NoActionBar and then all is OK !
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
a+
Vicnet
vicnet31 said:
I successfuly compile and test on Amazfit a "Heelo world" app.
As I said before I use Android Studio to generate an app for android 21 (I try 23 but apk don't install).
I don't use compat module.
The main pb was the app style, based on simple ActionToolbar in the first version, that not working (app dont launch).
I change in style.xml the parent style to NoActionBar and then all is OK !
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
a+
Vicnet
Click to expand...
Click to collapse
Great! are you able to make any network calls via wifi in the sample application?
I don't have the phone yet, but I'm planning to do some dev when I do get my hands on it.
le_lutin said:
Great! are you able to make any network calls via wifi in the sample application?
I don't have the phone yet, but I'm planning to do some dev when I do get my hands on it.
Click to expand...
Click to collapse
No, just show "Hello World" !
Nothing else, yet.
I intend to develop a stretching coach, but I have no need to access network yet.
a+
Vicnet
Hi, i need help guys, i need a smartwatch for handle heart rate for an Android App for my TFG.
Someone Know if i can get heart rate monitor data from Amazfit to another app develop by me?
It's my first time on Android app building, and i need some help
Thx
jorge_zk8 said:
Hi, i need help guys, i need a smartwatch for handle heart rate for an Android App for my TFG.
Someone Know if i can get heart rate monitor data from Amazfit to another app develop by me?
It's my first time on Android app building, and i need some help
Thx
Click to expand...
Click to collapse
I'm not an expert in Android development, but I don't think you can get anything out of Pace sensors. If you find a way, please post it here. I'm also interested in Amazfit Pace development.
Poslano sa mog Redmi 3 koristeći Tapatalk
slackovic said:
I'm not an expert in Android development, but I don't think you can get anything out of Pace sensors. If you find a way, please post it here. I'm also interested in Amazfit Pace development.
Poslano sa mog Redmi 3 koristeći Tapatalk
Click to expand...
Click to collapse
Huami/Xiaomi has web API available that you can make use of to create your own apps using the data available in their cloud. You need to be registered with them as a developer. There is a GitHub page that gives the details and web API description and all the information that is available via web API.
Google huami web API. You can find the GitHub page.
madtech360 said:
Huami/Xiaomi has webservices available that you can make use of to create your own apps using the data available in their cloud. You need to be registered with them as a developer. There is a GitHub page that gives the details and webservices description and all the information that is available via webservices.
Click to expand...
Click to collapse
Thanks! That's a usefull information. I'll trade to see what I can do
Poslano sa mog Redmi 3 koristeći Tapatalk
Anyone know if we can replace some of the system apps?
My idea is to modify the default music player so that it shuffles the music instead of playing it sequentially, but I guess it might need to be a system app (or at least have some specific permissions) in order to be available whilst running.
le_lutin said:
Anyone know if we can replace some of the system apps?
My idea is to modify the default music player so that it shuffles the music instead of playing it sequentially, but I guess it might need to be a system app (or at least have some specific permissions) in order to be available whilst running.
Click to expand...
Click to collapse
The default media player app is watch.huami.com.mediaplayer installed in the system/app folder. Given that we have root access on Pacefied, it should be possible to modify the system app. Also, the fact that we are able to make translations and install them implies changes to these app are possible.
BTW, the Media player app uses the following permissions:
Code:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
You can check to see if any of these are system only permissions and create your own app. I don't suppose you will need more than these permissions. Infact, you may need less permissions if you create your on music player app without wifi streaming
madtech360 said:
The default media player app is watch.huami.com.mediaplayer installed in the system/app folder. Given that we have root access on Pacefied, it should be possible to modify the system app. Also, the fact that we are able to make translations and install them implies changes to these app are possible.
BTW, the Media player app uses the following permissions:
Code:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
You can check to see if any of these are system only permissions and create your own app. I don't suppose you will need more than these permissions. Infact, you may need less permissions if you create your on music player app without wifi streaming
Click to expand...
Click to collapse
Thanks!
Hi!
I'm waiting for my new Amazfit And I wondering develops few small apps, it is possible to have network access from the watch? I just want to make a simple HTTP GET request.
Thanks!
jesuslg123 said:
Hi!
I'm waiting for my new Amazfit And I wondering develops few small apps, it is possible to have network access from the watch? I just want to make a simple HTTP GET request.
Thanks!
Click to expand...
Click to collapse
Hi, any news about using Wi-Fi connection in custom app?
I've just received that watch, I'm starting some development in next days. I will post here my experience
Krumok said:
Hi, any news about using Wi-Fi connection in custom app?
I've just received that watch, I'm starting some development in next days. I will post here my experience
Click to expand...
Click to collapse
I have been playing around and here is my summary:
Pair with Android:
http request works with the app in foreground or background
http request does NOT works with the app killed
Pair with iOS:
http request does NOT works with the app in foreground or background
http request does NOT works with the app killed
I'm trying to figerout what is wrong with iOS ... As far I see, watch is using Amazfit App as proxy to convert bluetooth request into real work network.
I hope this help.
jesuslg123 said:
I have been playing around and here is my summary:
Pair with Android:
http request works with the app in foreground or background
http request does NOT works with the app killed
Pair with iOS:
http request does NOT works with the app in foreground or background
http request does NOT works with the app killed
I'm trying to figerout what is wrong with iOS ... As far I see, watch is using Amazfit App as proxy to convert bluetooth request into real work network.
I hope this help.
Click to expand...
Click to collapse
That's weird - I thought that the watch would make a direct request to the network without needing to be even within range of the phone.
Do you have any sample code by the way? I was hoping to get started on some development for an app which downloads podcasts.
le_lutin said:
That's weird - I thought that the watch would make a direct request to the network without needing to be even within range of the phone.
Do you have any sample code by the way? I was hoping to get started on some development for an app which downloads podcasts.
Click to expand...
Click to collapse
Yeah, I thouht the same, I may wrong but I spent some time testing it and this is what I found....
Sorry I can't share the code, I have been using an app that use network, not just a sample. I'm iOS developer not Android, so I'm going slowly on Android code If you manage to get some sample minimalist app please share it
Ok, after some tests, I post my experience (only Android at this moment):
I have created a simple app that enable WiFi and then call a page with http.
As mentioned by @jesuslg123 only with watch no connection, the http call end with error.
If the phone is connected with companion smartphone app, works like a charm!
I've experienced a strange behavior:
If first I pair the watch and then start my app, as said before http works, now if I unpair the watch and disconnect smartphone from WiFi, my app on watch still works and is able to perform http request!!!
It seems that something is configured during pairing and it remains until the app on watch is in foreground.
I think the watch is unable to resolve url or something like that without companion app.
In the next days I will do some more tests.
I can share my code if you want, I'm not using pure java, I'm coding with b4a (Android) and b4i (ios).
Tell me if someone is interested
Krumok said:
Ok, after some tests, I post my experience (only Android at this moment):
I have created a simple app that enable WiFi and then call a page with http.
As mentioned by @jesuslg123 only with watch no connection, the http call end with error.
If the phone is connected with companion smartphone app, works like a charm!
I've experienced a strange behavior:
If first I pair the watch and then start my app, as said before http works, now if I unpair the watch and disconnect smartphone from WiFi, my app on watch still works and is able to perform http request!!!
It seems that something is configured during pairing and it remains until the app on watch is in foreground.
I think the watch is unable to resolve url or something like that without companion app.
In the next days I will do some more tests.
I can share my code if you want, I'm not using pure java, I'm coding with b4a (Android) and b4i (ios).
Tell me if someone is interested
Click to expand...
Click to collapse
Even if I unpair my watch, my watch is still getting notifications, I think is only truly un pair, when watch is restored... When phone was disconnected from wifi, 3G/Netowork was enabled?
I would like to test your app on iOS if you are happy to share the code or the APK, compiled may be easier
Thanks!