PACEfied Amazfit: APK development - Amazfit

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!

Related

[RFC] URL Fetch service

Have any of you app developers faced this situation: You have an app that needs to download data from the Internet, but don't want to add the Internet permission to your application, because it may deter some users from installing the app. Moreover, the data may be large and may need to be saved to the SD card, which requires yet another permission. You also need to ensure that a network is available currently, which means more permissions (WiFi state, etc).
Here's my proposed solution: A URL fetch service
This will be a simple app which accepts URL fetch requests from other applications and fetches them (HTTP GET) from the internet as a background service. Upon completion, the data can be returned to the application as a byte stream.
Since this is based on a callback, the network need not be currently available. The service will (optionally) queue the request and fetch whenever a network is available.
Another useful feature would be avoiding duplicate requests. For example, an app may want to fetch some data periodically, say every two hours. But if the network is not available for two days, then only one request should be made when the network becomes available, not 50! This could be done by letting the app assign a unique id to the request. Requests that have the same id will over-write other requests from the same app with the same id.
Logging and Filtering
From the user point of view, there is tremendous advantage in having a centralized URL Fetcher, because she will be able to Log the requests that go through it, and also filter some requests. For example, she could filter an app that she doesn't want to be updated (for whatever reason).
Distribution:
The app will be open-source and made available on all App markets and also as a direct APK download.
The only hurdle to this idea that I can see is that the app will have to be installed separately by the user. The problem will be reduced over time as more and more apps use this service. So the chances of the app being already present will increase. Also, custom ROMs might pre-package this app, so it will be present by default.
__________________________________
Your thoughts?
Update:
I have begun coding this up. You can follow / contribute here:
https://github.com/hrj/SafeNet/
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
For an app like that, you are not going to be able to not allow the internet permission. It needs it to fetch the URL (from the internet) so it has to use it... Unless you have a huge database of all URL's stored on your sd card .
Theonew said:
For an app like that, you are not going to be able to not allow the internet permission. It needs it to fetch the URL (from the internet) so it has to use it
Click to expand...
Click to collapse
Yes indeed. The fetch service app will have the Internet permission, and the read/write to SD card permission. The idea is to reduce the number of entities that the user has to trust.
And since the service app will be open-source, the user can compile her own version and install it. In that case, she doesn't even have to trust anyone else.
I have put up a tentative project and have some working code already in my local repository. If you would like to follow the progress or would like to contribute, here's the GitHub link:
https://github.com/hrj/SafeNet/
cheers!
h_r_j said:
the user can compile her own version and install it. In that case, she doesn't even have to trust anyone else.
Click to expand...
Click to collapse
Great. One thing... all the users of your app aren't only female...
Theonew said:
Great. One thing... all the users of your app aren't only female...
Click to expand...
Click to collapse
I guess you are right.. I didn't check thoroughly
But seriously, he / she / it doesn't really matter. I don't like typing "he or she" in every sentence. So, I just pick between those words randomly.
h_r_j said:
I guess you are right.. I didn't check thoroughly
But seriously, he / she / it doesn't really matter. I don't like typing "he or she" in every sentence. So, I just pick between those words randomly.
Click to expand...
Click to collapse
Just put "they" .

Easiest way to check if apps are spying?

A thread about the browser "Dolphin"'s security issues brought me to the question if there is an easy way to determine weather apps are sending critical or sensitive data somewhere?
Or what possibilities there are at all to determine it.
I plan to replace my laptop with my tablet and this means I would want to do critical things as online banking with the tablet.
And unfortunately there is no app by the bank to do it.
I'd like to know that too
retsam88 said:
I'd like to know that too
Click to expand...
Click to collapse
me too
A thread about the browser "Dolphin"'s security issues brought me to the question if there is an easy way to determine weather apps are sending critical or sensitive data somewhere?<br />
<br />
Or what possibilities there are at all to determine it.<br />
I plan to replace my laptop with my tablet and this means I would want to do critical things as online banking with the tablet.<br />
And unfortunately there is no app by the bank to do it.
Click to expand...
Click to collapse
Detection by own:
1. De-compile the app with apktool and analyse its source code. You should de-compile even if the app is open source.
2. Use WireShark to analyse whole traffic.
Causions:
1. Use Permission Fix app to remove suspicious permission of app.
2. Use only popular apps. Popular apps are monitored by community and security companies. So, you'd never need to do detection by your own. Just, make sure you've subscribed to security mailing lists.
3. Use a nice Anti-virus. It can notify you about privacy risk, too.
4. Install only trusted apps. Many companies provide Trust seal for apps. For example, TrustGo Anti-virus and Amazon App Store.

[Q] Launch any app from URL

Hi there,
i got a little problem:
I got a Loxon (loxone.com) home automation system.
In there, there's a function to open app from URLs, as far as i understood it works through the intent service, for example i tested with success the yatse xbmc remote.
I launched the app through yatse:// as defined on the yatse developers web page.
So and now my problem:
as far as i understand the apps developer needs to define a custom intent sheeme in the apps manifest.xml
But there aren't many app developers using the custom intents, so i want to add the feature by myself.
I read about it on many websites but never got it to work. i don't need actions defined, such as open sms app and preinsert the number, just open the apps, for example squeezeplayer:// for the squeeze box apk.
Could anyone please give me a before-after example for an app? That would be awesome.
I know about decompiling apks, editing the manifest so no need for an detailed step-by step.
I know about a negative side effect after editing the manifest if an app update is installed the changes go away, but thats sometihing i can live with. (set aut update off):silly:
Thanks in advance
Edit
: i found this on stack overflow for opening apps through url but never got it to work:
http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser

[APP] Heatmap - new app straight from the Galaxy S5 Active

The application area of activity, which has some useful features. You could say that this is the kind of addition to application S Health, aimed at those with active lifestyles.
Download the program Heatmap
Looks good but needs a huge amount of permissions. Normally I'm not interested in permissions but that was 2 pages full of permission requests incl. SMS, Phonebook, etc. Why should this app need this? Anybody knows why? Don't installed it.
Thanks for the app, it looks nice and useful
Sent from my SM-G900F using Tapatalk
mmeidl78 said:
Looks good but needs a huge amount of permissions. Normally I'm not interested in permissions but that was 2 pages full of permission requests incl. SMS, Phonebook, etc. Why should this app need this? Anybody knows why? Don't installed it.
Click to expand...
Click to collapse
not in the store either, spyware? TOO RISKY
The reason for the permissions is because the app acts under the System User ID, therefore can access any permission the system process has access to (ie all of them).
Here is the permissions part of the Android_Manifest file - note the android:sharedUserId field:
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.system" package="com.sec.activemode">
<permission android:name="com.sec.activemode.compass.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.sec.activemode.compass.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="dangerous"/>
<permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="dangerous"/>
I will further reverse engineer this tomorrow to see if I can determine if it uses any dangerous permissions and if it really needs to operate under the system user. As a general rule of thumb I would never trust an app that operates under the system user unless I had full access to the source code - I run one of my own apps under the system user because the class it accesses isn't visible to a standard user id (acts as a shortcut to the KitKat Easter Egg on HTC phones because HTC always disable the easter eggs) but then again, I have the source code and I built it so I know its not dangerous, with this though I can't be sure
Firstly thanks for the effort. I tried it and works with out any issues....
Jonny said:
The reason for the permissions is because the app acts under the System User ID, therefore can access any permission the system process has access to (ie all of them).
I will further reverse engineer this tomorrow to see if I can determine if it uses any dangerous permissions and if it really needs to operate under the system user. As a general rule of thumb I would never trust an app that operates under the system user unless I had full access to the source code - I run one of my own apps under the system user because the class it accesses isn't visible to a standard user id (acts as a shortcut to the KitKat Easter Egg on HTC phones because HTC always disable the easter eggs) but then again, I have the source code and I built it so I know its not dangerous, with this though I can't be sure
Click to expand...
Click to collapse
This app is from S5 Active ROM. This is pretty normal for system app. As a part of Samsung ecosystem it shares data between different Samsung apps.
By the way, this app uses shared user ID and protected by common signature from Samsung. If you tamper this apk, then it won't be able to install on stock ROM (unless you use core patch to eliminate signature verification). Thus, IMHO, there is no reason to pay so much attention to permissions required by this app.
Please can someone put a direct XDA download link?
Does not work with a Nexus 5
sorg said:
This app is from S5 Active ROM. This is pretty normal for system app. As a part of Samsung ecosystem it shares data between different Samsung apps.
By the way, this app uses shared user ID and protected by common signature from Samsung. If you tamper this apk, then it won't be able to install on stock ROM (unless you use core patch to eliminate signature verification). Thus, IMHO, there is no reason to pay so much attention to permissions required by this app.
Click to expand...
Click to collapse
Thanks, must have been half asleep when originally investigating that, not sure how I missed it Also if its a system app it should be pushed to system/app/ or system/priv-app/ (not sure which it is on Samsung phones seeing as I don't own one but my guess would be system/priv-app/) instead of being installed.

[DEV/LIBRARY]Amazfit Communication: 2 way communication for Pace/Stratos inc internet

Amazfit Communication Library
The Amazfit Communication Library is a reverse engineered and modified version of the Huami "Transporter" class (and its subclass "TransporterClassic"), along with its dependencies. This allows both sending and receiving data on both the phone and the watch, using the same library.
Bascially, this allows apps on the watch to access data via a companion app on the phone. To make this easier, this library comes hand in hand with the "AmazfitInternetCommunication" app, which can be installed on the phone and allows apps on the watch to access the internet and perform simple requests, with data in response.
However, you can use this library with your own companion app on the phone to access any data the phone app has access to, for example a companion app on the phone with access to calendar appointments would allow a watch app to display events on a calendar, on the watch.
Usage
See the GitHub repo for the latest code and guide for addition of the library. You can also compile it if you wish.
Amazfit Internet Companion
Amazfit Internet Companion is a generic and open source internet companion app for the Amazfit Pace and Stratos. It allows apps developed with the Amazfit Communication library to access the internet over Bluetooth via a phone's internet connection. As a developer, rather than having to develop your own companion app, you can simply have your users install the companion app and it'll handle the rest, so long as you use the internet functions in the library (LocalURLRequest). Link them to the thread or use your own guide, linking to the latest APK from the repo to use this.
Alternatively, you can develop your own companion app. This could be used for loads of things, for example a companion app could provide a watch app with the calendar events on the phone, provided the phone app had the right permissions and formatted the data correctly. If you want to make your own companion app, feel free to use the Internet Companion app as a base
Hi Quinny, thanks for your great work. Did you make tests of how much this affects the battery life, egg with your train app?
Is it possible to run this in as a background service on watch?
Klaus3d said:
Hi Quinny, thanks for your great work. Did you make tests of how much this affects the battery life, egg with your train app?
Is it possible to run this in as a background service on watch?
Click to expand...
Click to collapse
I've not done proper tests but I've had it running for a few days with no noticeable effect on the life. Yes, you should be able to use a background service on the watch, if you need an app on the watch to always be available for receiving information from the phone - but bear in mind that the watch only has 512MB of RAM, so a running service is more taxing on the watch compared to a phone. You may be better off with a background service on the phone that stores the information you wish to send to the watch, which then responds to the watch app when it's run - an ondemand request if you will
Quinny899 said:
I've not done proper tests but I've had it running for a few days with no noticeable effect on the life. Yes, you should be able to use a background service on the watch, if you need an app on the watch to always be available for receiving information from the phone - but bear in mind that the watch only has 512MB of RAM, so a running service is more taxing on the watch compared to a phone. You may be better off with a background service on the phone that stores the information you wish to send to the watch, which then responds to the watch app when it's run - an ondemand request if you will
Click to expand...
Click to collapse
So if the watch can get any data from the phone, does that mean I can run Wear apps, like the Hangouts Wear app, on the watch and use it as it works on a regular Wear device? If so that would be incredible.
still work for watches in 2020?
hello, I know it's been a while since the last time this topic was discussed, does anyone know how to inform without this package still working today? I recently purchased an amazfit verge and since my house is completely automated, I want to develop an app for personal use ... thanks!
delphiover said:
hello, I know it's been a while since the last time this topic was discussed, does anyone know how to inform without this package still working today? I recently purchased an amazfit verge and since my house is completely automated, I want to develop an app for personal use ... thanks!
Click to expand...
Click to collapse
Still works, not tested it on the Verge though. Should work the same, they use the same framework I think.
Quinny899 said:
Still works, not tested it on the Verge though. Should work the same, they use the same framework I think.
Click to expand...
Click to collapse
cool, thanks for the reply!

Categories

Resources