Related
Since there is no Forum for the Mi Band ...
After receiving my Mi Band yesterday I started digging inside the sourcecode of the Mi Band App to find out interesting stuff.
It works with all BLE device, not only Xiaomi ones
It uses an unsecure protocoll which can be reverse engineered, so you could build an API out of it or port it to other mobile OS.
I will update algorithms & the protocol asap, but there is already a lot of usefull stuff on the protocol inside my blog: http://allmydroids.blogspot.de/2014/12/xiaomi-mi-band-ble-protocol-reverse.html
If someone is interested in writing an API, contact me.
Great! But some questions:
1) when you say "I started digging inside the sourcecode" you mean the smali decompiled from the app apk, right? Or is there some open code I missed?
2) if we create an apk which exposes the API (for example via android intents) can it connect to the device at the same time with the original Mi app? Or is the pairing exclusive to an app so we have to hack the app itself (for example via an Xposed module)? (Note: I'm extremely ignorant about bluetooth LE).
Thank you!
bitblaster said:
Great! But some questions:
1) when you say "I started digging inside the sourcecode" you mean the smali decompiled from the app apk, right? Or is there some open code I missed?
Click to expand...
Click to collapse
Decompiled and looked at smali + java from smali (which skips stuff so make sure to check original smali, too)
bitblaster said:
if we create an apk which exposes the API (for example via android intents) can it connect to the device at the same time with the original Mi app? Or is the pairing exclusive to an app so we have to hack the app itself (for example via an Xposed module)? (Note: I'm extremely ignorant about bluetooth LE).
Click to expand...
Click to collapse
We are currently developing a BLE app to a customer and I agree that it is horrible. Android has really messed up everything they could when it comes to BLE.
Other apps could access at the same time. Pairing is done through the Android not the app itself. Although it could be that the band itself limits this somehow. I will check that soon.
Awesome...I'm glad I found this. I just got my band and didn't realize it only worked with the app from XIAOMI. Very disappointed. Also, I can't even set mine up right now. I set up an account and when I go to sign in it says I have the wrong password! When I go to reset the password it has to SMS me a verification code and it NEVER COMES. Total waste.
I hope you guys get this working soon and we can use it with apps that won't send our data back to mainland China. Do you know if this will work with 'Sleep as Android'? That's what I got this for. I thought it was a basic bluetooth device, not some proprietary POS.
NeoMatrixJR said:
Do you know if this will work with 'Sleep as Android'? That's what I got this for. I thought it was a basic bluetooth device, not some proprietary POS.
Click to expand...
Click to collapse
I uploaded a very first Android App today but it can do only very few things yet - but currently it doesn't do the setup. I don't know that app so I don't know if it can interact with other devices and if, how good. But the Miband can detect sleep phases (pretty good for me) and can wake you, so I guess it could be possible.
motioncoding said:
I uploaded a very first Android App today but it can do only very few things yet - but currently it doesn't do the setup. I don't know that app so I don't know if it can interact with other devices and if, how good. But the Miband can detect sleep phases (pretty good for me) and can wake you, so I guess it could be possible.
Click to expand...
Click to collapse
Downloaded and tried to install your app. Unfortunately gave me an error. Looking forward to a new version.
Thanks for your effort [emoji106]
andbroe said:
Downloaded and tried to install your app. Unfortunately gave me an error. Looking forward to a new version.
Click to expand...
Click to collapse
Does your device support Bluetooth LE and is Bluetooth enabled?
motioncoding said:
Does your device support Bluetooth LE and is Bluetooth enabled?
Click to expand...
Click to collapse
Yes and yes. The problem is during installation. "Error parsing the package"
My phone is a Samsung Note 3
Cheers from Switzerland
andbroe said:
Yes and yes. The problem is during installation. "Error parsing the package"
Click to expand...
Click to collapse
Ah you tried the .apk from /bin? Thats not working. You have to compile it. I will upload a working one when it has some more features.
Hello again,
downloaded and installed Android Studio. Compiled your project, all went quite smooth. Unfortunatly the app still does not quite work. Without the band close it quickly complains that there is no band around (good). With my miband close, it scans for ever (not good). Somehow it does not communicate with it.
The BLE Device Monitor detects it well.
Regards
andbroe said:
Hello again,
downloaded and installed Android Studio. Compiled your project, all went quite smooth. Unfortunatly the app still does not quite work. Without the band close it quickly complains that there is no band around (good). With my miband close, it scans for ever (not good). Somehow it does not communicate with it.
The BLE Device Monitor detects it well.
Regards
Click to expand...
Click to collapse
Hi,
I tried the same actions. Seems problem with discovering.
According to google:
startLeScan: Added in API level 18 This method was deprecated in API level 21.
Changed API from default 21 to 18 - nothing has changed.
MI device is visible in other BLE apps, in Bluetooth settings as well. Original translated app working well.
Nexus 4, android 4.4.4
Android Studio 1.0.1
Regards,
Klym
yeah, I commented out the code that actually loads data. Will fix that.
Could you get the Mi Band to sync with Google Fit?
---------- Post added at 09:45 PM ---------- Previous post was at 08:49 PM ----------
motioncoding said:
I uploaded a very first Android App today but it can do only very few things yet - but currently it doesn't do the setup. I don't know that app so I don't know if it can interact with other devices and if, how good. But the Miband can detect sleep phases (pretty good for me) and can wake you, so I guess it could be possible.
Click to expand...
Click to collapse
There is an api for Sleep as Android.
https://sites.google.com/site/sleepasandroid/doc/sleepcloud-api
How about accelerometer raw data or sleep data, is it available?
Hi,
i try to connect my miBand with my laptop.
I found this site with some source code:
https://bitbucket.org/OscarAcena/mibanda
I installed all dependencies and run this as sudo python miband.py:
Code:
from gattlib import DiscoveryService
service = DiscoveryService("hci0")
devices = service.discover(2)
for address, name in devices.items():
print("name: {}, address: {}".format(name, address))
But after 10 seconds, I get an empty result.
My hciconfig shows this:
Code:
[email protected]:~$ hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 00:C2:C6:59:91:73 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:1475 acl:0 sco:0 events:71 errors:0
TX bytes:1723 acl:0 sco:0 commands:47 errors:0
Does anyone know, what to do?
I'd happily swing a few bucks for an app where it can link with google fit.
reconchrist said:
I'd happily swing a few bucks for an app where it can link with google fit.
Click to expand...
Click to collapse
Well...
I just have a quick questions about the possible functionality of the MiBand and what has been discovered thus far. Can the LEDs be individually controlled? Also, I know you can dismiss an alarm by touching the MiBand, does it detect this touch through motion or is there a capacitive switch in the MiBand?
I don't know how much help I can be, but I'm just curious about the technologies that they've been able to pack into the band.
Devo7v said:
I know you can dismiss an alarm by touching the MiBand, does it detect this touch through motion or is there a capacitive switch in the MiBand?
Click to expand...
Click to collapse
Seems there is no "touchpad", when needed (alarm and pairing) bracelet just detect vibrations from finger knocks.
Very likely it's internal firmware function and can't be accessed outside.
Also some advertising: useful additions for Mi Band
@motioncoding
Can you please tell me what Bluetooth profiles are supported by Mi Band ?
For this:
1. Go to the Bluetooth settings on your phone
2. There you will see the names of Bluetooth devices listed including the Mi Band
3. There will be a gear (or options) icon beside the name... tap on that and please post a screenshot of the screen that appears.
Thank You
Hi,
I'm looking to create an app for a KW88 (KingWear) smartwatch I've purchased and awaiting it to be shipped to me.
As this smartwatch has a sim card, it may double as a phone. Therefore, I wonder, if I create a standalone app for the smartwatch (It is supposed to show the pictures of contacts and then, on press, call them), do I need to make a normal android app or an Android wear app?
(Implying it is possible to have a third party app completely standalone on the KW88 watch in the first place.....)
many thanks for the answers!
Regards,
Wattah
Wattah said:
Hi,
I'm looking to create an app for a KW88 (KingWear) smartwatch I've purchased and awaiting it to be shipped to me.
As this smartwatch has a sim card, it may double as a phone. Therefore, I wonder, if I create a standalone app for the smartwatch (It is supposed to show the pictures of contacts and then, on press, call them), do I need to make a normal android app or an Android wear app?
(Implying it is possible to have a third party app completely standalone on the KW88 watch in the first place.....)
many thanks for the answers!
Regards,
Wattah
Click to expand...
Click to collapse
Careful, Wattah!
The KingWear KW88 runs on Android 5.1 and not Android Wear - which means it doesn't support apps made for Android Wear at all...
This standalone app you meantioned won't be integrated and run only if you open it manually. Native support in terms of using this app instead of the built in app will be difficult to work around. (see launcher apks on Google+ forums)
Hope that finds you well
Best regards,
Daniel
Welp, sorry, apparently I've never said anything back.
Thanks for the answer, as it actually made things a lot easier. I've now programmed an app and using a app called Always on, the app is nearly always on. What I intend to create is a skin over the KW88 device which will make it much more usable for elderly people.
What I noticed is that sometimes, using the physical button, the app will close and display the watch face. For us it is easy to navigate through the watch face, but I need it to be as easy as it can ever be and so, i need the face removed.... Is there any way to either: remove the face alltogether or have this app be incorporated in the face (it needs to be able to handle calls and use GPS)....
Royal_D said:
Careful, Wattah!
The KingWear KW88 runs on Android 5.1 and not Android Wear - which means it doesn't support apps made for Android Wear at all...
This standalone app you meantioned won't be integrated and run only if you open it manually. Native support in terms of using this app instead of the built in app will be difficult to work around. (see launcher apks on Google+ forums)
Hope that finds you well
Best regards,
Daniel
Click to expand...
Click to collapse
Hi guys, what a about use kingroot to root it and then use no frill cpu to set cpu as lower frequency to save battery, might be work?
A few days ago I purchased my Withings (by Nokia) Steel HR, which is one of these new cool-looking smartwatches, with continuous heart monitor and 25 days battery life.
However, it comes in a quite closed environment (virtually no settings anywhere) and only works with the Withings app, which is quite poorly integrated.
I'm easily thinking of a ton of features to be added directly or indirectly, which brings me to the wish to use it with other apps and to mod its software. (A first thing would be to be able to change the frequency at which heart readings are taken, and to be able to export raw data to my phone which are not available at the moment)
Any aspiring (or experienced) dev out there with this smartwatch?
By the way, mods aside I honestly think that this watch is full of potential and its software will receive many updates in the future, so be sure to check it out if you're looking to buy a smartwatch in the near future (This is not an ad, but it would be great to build up an xda community around this! )
I'm getting this watch as well. Let's hope it will have development potential
Hi,
I have this watch as well. I have been trying to sniff the BLE protocol, to send my hr to apps like Runtastic, without success.
A quick note worth mentioning: this watch shows you three types of notifications (plus alarms): sms, calendar, and phone calls. While you can't "fake" sms and phone calls, you can create as many calendar events as you want.
In other words, do you want to see weather updates on your watch? put together something like a Tasker task or an IFTTT recipe that automatically creates a google calendar event with the information you want displayed as the title, and you're done. Combine it with Tasker to ignore/remove the notification on your smartphone and voila', any-notifications on our withings steel hr
cheers
Hi,
I am considering to buy a Mi Band 5. But I am definitely not going to use the MiFit app, as I don't want to share my health data (or any data, for that matter) with a Chinese company.
So I was looking at Notify & Fitness. I understand that in the past you needed to use a modified MiFit app to obtain some Auth code. I could certainly do that if necessary, using some old, empty, rooted Android phone.
But on the current Play Store page of N&F it says "All Mi Bands 1,2,3,4,5 supported. No official app needed". They even claim that N&F can do firmware updates.
Can anyone here confirm this? Have the N&F people figured out how to pair the device without the AuthKey / completely without MiFit? This almost sounds too good to be true. Even less plausible seems the firmware update claim.
And while we are at it, does N&F allow controlling Android music apps from the Mi Band (in my case, Shuttle+ music player)?
Thanks a lot, and Cheers,
rh
rhhd said:
Hi,
I am considering to buy a Mi Band 5. But I am definitely not going to use the MiFit app, as I don't want to share my health data (or any data, for that matter) with a Chinese company.
So I was looking at Notify & Fitness. I understand that in the past you needed to use a modified MiFit app to obtain some Auth code. I could certainly do that if necessary, using some old, empty, rooted Android phone.
But on the current Play Store page of N&F it says "All Mi Bands 1,2,3,4,5 supported. No official app needed". They even claim that N&F can do firmware updates.
Can anyone here confirm this? Have the N&F people figured out how to pair the device without the AuthKey / completely without MiFit? This almost sounds too good to be true. Even less plausible seems the firmware update claim.
And while we are at it, does N&F allow controlling Android music apps from the Mi Band (in my case, Shuttle+ music player)?
Thanks a lot, and Cheers,
rh
Click to expand...
Click to collapse
I have just purchased a Mi Smart Band 5 purely for the heart rate and sleep data for Google Fit and I don't like the idea of the data being shared with a Chinese company.
The initial install of the MiFit app seems to suggest you don't need to sign up for a Mi account and offers FaceBook & Google as options, however neither of these work and I get a message saying this isn't available in my region (UK). So I set up a Mi account just to play around with it. It all seems to work OK and it connects to Google Fit and provides the sleep & heart rate data.
I installed the Notify & Fitness app from the Play Store, however it just doesn't work. I have tried with the MiFit app installed as well as without it (using the Mod'd MiFit app to get the AuthKey). It just doesn't connect. The guide on the website - http://forum.mibandnotify.com/discussion/184/band-is-not-connecting-pairing-and-sync-solutions doesn't help at all. It seems to suggest my band isn't genuine?
In the Notify settings it shows the correct MAC address but says 'Band Identifier -1 - Unknown device'. None of the tests in the Notify app work - i.e. display text, vibrate etc.
I have tried three different phones (Pixel 4XL with stock Android 11, a Samsung Galaxy S6 and a S6 Edge running the Pixel Experience Android 10 ROM) and its the same behaviour on all of them.
Its as if the app doesn't have access to bluetooth?
I'll keep playing around with it but its not looking good.
EDIT: I downloaded an earlier version of Notify & Fitness for Mi Band from a mirror site (10.1.4) as opposed to the latest version on the Play Store (10.3.8) and this worked first time. It looks like the app was only updated on the Play Store yesterday so I suspect there is a bug,....
ADB100 said:
EDIT: I downloaded an earlier version of Notify & Fitness for Mi Band from a mirror site (10.1.4) as opposed to the latest version on the Play Store (10.3.8) and this worked first time. It looks like the app was only updated on the Play Store yesterday so I suspect there is a bug,....
Click to expand...
Click to collapse
Awesome, thanks for the feedback. :good:
Can you confirm that it is possible to setup the MB5 without ever installing MiFit? Thanks again!
rhhd said:
Awesome, thanks for the feedback. :good:
Can you confirm that it is possible to setup the MB5 without ever installing MiFit? Thanks again!
Click to expand...
Click to collapse
No, I think you need to go through the process at least once.....
Gadget Bridge for Mi Band 6 Privacy oriented and Open source build
A free and cloudless replacement for your gadget vendors' closed source Android applications.
i am using it as a daily driver, and they gave recent support for mi band 6, and i am loving it INFO
Gadgetbridge, an open-source app that focuses on removing the manufacturer out of the equation.
Gadgetbridge is an android application that allows users to use various smart bands such as Pebble, Mi Band,
Amazfit Bip, HPlus ZeBand, XWatch, and more, without constantly utilizing the vendor’s closed source application.
It also does away with the need to create an account and transmit your user data to the vendor. What’s more,
the open source nature of this app allows users to be confident about how their data is handled and ensure that it
does not leave their devices. -- XDA
Changelog 0.57.0. Initial limited support for Mi Band 6
Thanks to a PR, we recently merged, Gadgetbridge 0.57.0 is the first release which supports the new Mi Band 6.
We call support limited, since it does not yet support flashing the firmware or watchfaces and not everything is tested yet.
But thanks to your donations we were able to order one, which will (once it arrives) enable us to test and improve device support!
--Gadgetbridge team
Credits for the Mi band 6 support
Jhey: https://codeberg.org/jhey
link for built apk with mi band 6 support
https://drive.google.com/file/d/1gJmleH4-QisotX7GNAsxxSZXZjVU9505/view?usp=sharing
Your Mi band should be Connected to the Mi Fit App with your Mi Account, this is required to get the
Bluetooth Authentication key for our MI Band which will used later in the process, also do not unpair from Mi fit app
Step 1: Building the app from source Application home page
https://gadgetbridge.org
Install Android Studio
https://developer.android.com/studio
From Android Studio open SDK manager, download and install SDK 29(Android 10)
Install python3
https://www.python.org/downloads/
Clone the repo to Downloads folder from this url
https://codeberg.org/Freeyourgadget/Gadgetbridge
Create a local.properties file in the Gadgetbridge folder its contents should contain sdk location
sdk.dir = /Users/vamzi/Library/Android/sdk
Lets start with the APK build process
open Terminal, Change Directory to the gadget bridge folder using
cd ~/Downloads/gadgetbridge
and execute this command
to start the build process
./gradlew assembleDebug
or
./gradlew assembleRelease
Step 2: Obtaining the Authentication key
Clone the following Repo:
https://github.com/argrento/huami-token
Open terminal change directory to the cloned huami-token folder:
cd huami-token
Install the python dependencies using the following command:
pip3 install -r requirements.txt
Start obtaining the auth key :
python huami_token.py --method xiaomi --bt_keys
Copy the link generated under the script to a browser, login to your MI Account which is
bonded to our Mi band, copy the link generated after you login to the python terminal,
and press enter This will generate the Auth_Key copy it and save it. send that authkey
to your android device via mail or message
Step 3: Install the Generated or Downloaded Gadget Bridge apk give all the required
permissions and Notification access too, Before we start the pairing process, disable
or uninstall Mi Fit app, so it doesnt interrupt our GadgetBridge pairing proces.
on Gadget Bridge, start by tapping on the add button, give the location access,
as android needs location access to scan for bluetooth devices. tap on Start discovery
this should display the Mi band 6 tap and hold on it, to start configuring the settings.
paste in the Authentication key and change other settings to your liking.
tap on the back button, this will start the pairing process, and should add your mi band 6 to the application.
this app is a good alternative for the Mi Fit app, and this makes it possible to go thorough your health and activity stats on your device without the need to share it with the device manufacturer. Donate to Gadget bridge Devs for making this awesome app https://liberapay.com/Gadgetbridge/donate and if you are good at coding, Contributions are welcome, be it feedback, bug reports, documentation, translation, research or code. Feel free to work on any of the open issues; just leave a comment that you're working on one to avoid duplicated work. --devs at GadgetBridge
Sorry, but at my opinion it is useless at this time for normal users.
Without the right knowledge, i can't pair with miband 6.
And most of the features are not usable. So notify&fitness seems to be the better choice.
Icetea said:
Sorry, but at my opinion it is useless at this time for normal users.
Without the right knowledge, i can't pair with miband 6.
And most of the features are not usable. So notify&fitness seems to be the better choice.
Click to expand...
Click to collapse
i agree with you icetea, but the option is still there and might be helpful to for people who are looking at it, also as it is an opensource project, if there is enough people ready to contribute for this project, it has a lot of scope
thx but i will stay at stock app.
Icetea said:
thx but i will stay at stock app.
Click to expand...
Click to collapse
That is your wish mate, for people who dont want their data to be mined by companies this is a good alternative
Haha... I think, using a android phone is not the right way to prevent datamining.
Btw. on reddit i have found a page with a miBand 6 ready compiled version of gadgetbridge as a download link. But have not tried it because as i understand, it seems not be able to work without auth.key.
Icetea said:
Haha... I think, using a android phone is not the right way to prevent datamining.
Btw. on reddit i have found a page with a miBand 6 ready compiled version of gadgetbridge as a download link. But have not tried it because as i understand, it seems not be able to work without auth.key.
Click to expand...
Click to collapse
Lol u r right ice tea, some people are using android without gapps, and getting ur data mined by google is much better than getting mined by these chinese companies , reddit thread is most likely mine i guess
I have tried to use this version from f-droid but it does not pair my watch.
Authkey doesn't match. I am out now... I have no time for further experiments.
Icetea said:
I have tried to use this version from f-droid but it does not pair my watch.
Authkey doesn't match. I am out now... I have no time for further experiments.
Click to expand...
Click to collapse
Loll sorry mate, f droid updates take a while to update the latest app from the development repo, also they are planning to add alternate release channel with latest updates on their development page.
Gadgetbridge | F-Droid - Free and Open Source Android App Repository
Use your Pebble/Bip/Miband/Hplus/[more] and keep your data private!
f-droid.org
That seems to be the same version as yours. V0.57.0!
Thank you for the guide!
I hope more people could contribute on gadgetbridge, bc the cloudless idea is great to keep your data save!
Icetea said:
Haha... I think, using a android phone is not the right way to prevent datamining.
Click to expand...
Click to collapse
it depends on how you use it
Will try tomorrow my new Bip u pro to connect with gadgetbridge, my Bip s already works with it without problems. Hopefully they can expand the features.