4

I want to connect to Mi Fit application in a same way like Notify for Mi Band does. In this application there are two options to connect to Mi Band. The first one which connects to it needs auth token from freemyband and possible this also needs rooted phone/custom Mi Fit application installed. I understand this method, but there is an option to connect to Mi Band through the Mi Fit application, which needs running instance of it and it does not need rooted phone.

My question is how can I connect to the Smart Band through the Mi Fit application?

Norbert
  • 302
  • 1
  • 9
  • 19

2 Answers2

3

First off, I found a well-documented unofficial SDK for the Mi Band - I actually haven't tried it out and thus I won't go into detail with this option. For the sake of completeness, I decided to include it in this reply.


Xiaomi, the company behind the Mi Band, has an SDK for Android (as well as iOS). It has been released in 2015 and according to a few online reports it seems to be still working. Unfortunately, it's only available in Simplified Chinese, though with the usage of a good translation software you should be able to read it.

Under their FAQ they also include two contact options in case you have any questions, for one their email, being DevFit@xiaomi.com and a Tencent QQ group id: 385428920. For reference here is the translated version:

If you encounter any problems during the integration, please contact us: DevFit@xiaomi.com. You can also add QQ group: 385428920, there will be engineers in the group to answer your questions.

The mentioned SDK has a huge variety of available data points such as TYPE_BODY_FAT_PERCENTAGE, TYPE_HEART_RATE_BPM, TYPE_SPEED and many more. All well documented and explained what datatype you will receive, how you can request it. (cf. 2. Basic concepts and 3. Data Format).


After doing further digging, I found an updated documentation from September of 2020. The whole documentation is written in Chinese, though it includes the whole process from account creation and verification to publishing an App which requests, for example information from the Mi Band.

This doesn't imply that the other options above don't work - it's just an updated version, hence I highly suggest to check and evaluate the different possibilities in order to find a proper solution to the problem - many roads lead to Rome.

J. M. Arnold
  • 6,261
  • 3
  • 20
  • 38
  • Thank you for your answer! I have already tried the first one you mentioned, as far as I remember it was a simple Bluetooth LE client, reading the data using GATT. With a slightly modification I was able to read the data from the Mi Band, but my problem is this is just reads the real-time data and you cannot access the historical and sleep data. I also saw the second SDK but it looked outdated for me, that is why I did not try it. I will get back if I have some results with that SDK. Thanks for your help again! – Norbert Jan 04 '21 at 16:37
  • @Norbert Keep me updated! While doing my research I also looked at Xiaomi’s Github - there are many repositories (though unfortunately I’m Chinese); it might be worth taking a look at them as well (I checked them, but wasn’t able to find anything at first glance). – J. M. Arnold Jan 04 '21 at 16:54
  • @Norbert I found the updated API! Obviously [their page](https://dev.mi.com/console/) is all in Chinese, though after clicking through the documentation, which has been updated in September of 2020, I found [useful informations](https://dev.mi.com/console/) such as how to request a developer account with which permissions and so on. I'll update my answer. – J. M. Arnold Jan 04 '21 at 17:59
  • Oh, wow! Thank you! I will check the documentation. I hope I can read it with google translate. – Norbert Jan 04 '21 at 19:33
0

The newest version of the Mi Fit application (the one you get from the Android Google Play Store or iOS the App Store) has issues while authenticating for connection to any Mi Band device (I can't remember the issue exactly - but it essentially created a sort of inescapable loop. The application would ask you to enter an authentication code from your Mi Band device's display, but when the dialog to enter the code popped up an error box would also pop up preventing you from entering the code and forcing you to regenerate a new authentication code, upon which the same thing would happen.)

The simple fix to this is to download an older Mi Band SDK - the newest version that still works is 4.0.15 - you can just google "Mi Fit 4.0.15" or just click on this link (https://www.apkmirror.com/apk/anhui-huami-information-technology-co-ltd/mi-fit/mi-fit-4-0-15-release), although from my experience not all sites worked for the download. Visit the link on your mobile phone, and then pairing your Mi Band device should be relatively straightforward.

catfood
  • 345
  • 3
  • 14
  • 1
    Sorry, but I think my question was ambiguous. My question was about developing an application (in Java, Kotlin, etc), which connects to the Mi Fit application and syncronizes the data. – Norbert Jan 05 '21 at 16:12
  • I apologize. I'll leave my answers here for any passers-by in need. – catfood Jan 05 '21 at 22:43