I’ve decided to improve miband integration, and change the method which was used to represent glucose data for MiBand4. Instead of the date modifying and using a custom watchface which interpreter a custom date format in correct way, i will generate entire watchface with a dynamic background and upload this watchface to the band. By using this method, all the disadvantages of changing the date on the watch will disappear, and your watch will be fully functional. So it would be possible to use it with any program, and all band features like weather, music control, fitness progress, and more would work.
In addition, this method allowing to display any data on the watch screen.
I’ve finished a new xdrip version . Would be grateful if someone can help to test it on different miband versions. If this version would be stable, i’ll create a pull request for the official Xdrip apk version. So there would be a chance this patch would be added to the official aplication.
Great news! The pull request was recently approved and merged into official xdrip application. At the moment it is available in the latest nightly build xdrip version which can be downloaded from the following URL https://github.com/NightscoutFoundation/xDrip/releases
New watchface legend
Real view on miband4 and v0.2.4 with enabled graph and bolus
Configuration tutorial by steps for v 0.2.x
1. Obtaining auth key
If you want to use xdrip with Mi Band4, you need to get Mi Band 4 Auth key (for the older devices (MiBand2 and Miband3), you can skip this step). The Auth key can be obtained with these simple steps (was copied from https://www.freemyband.com/ )
- Unpair band from the existing official app
- Uninstall official app
- Download and install the moddified MiFit application Mi Fit mod apk
- Login into the Mi Fit with your email account
- Pair the band
- Enable band visibility in the MiFit settings.
- Now you can uninstall modified Mi Fit application and install official Mi Fit or any other apk you like to use together with miband. If you would use official Mi Fit aplication , you would need to Login into the Mi Fit with the email which was used with patched application.
- Finished! You can find your Auth key on /sdcard/freemyband folder of your phone
- If you reset (MAC address of band change) or unpaired your band, the Auth key need to be calculated again. The miband will change the MAC address, so you should change mac and auth key in xdrip(for auto search you can clear mac address and auth key fields)
- The modded mifit apk is compatible with any firmware version installed on your band
- You can do this procedure with any phone (if your phone doesn’t allow install apk outside Play Store, you can ask your friend to obtain this auth code for you)
2. xdrip configuration. Connecting to miband
- If you have original xdrip application installed on your phone, you would need to delete it. To save all your existent settings and glucose history, you can export your current database into file. To do this, click to the 3 dots on the main xdrip screen, select Import/export feature -> export database.
- Install latest patched xdrip from this link xdrip-miband . If you had a database backup, you can restore it by using export/import feature mentioned earlier.
- If you skipped “Obtaining auth key” phase (only for miband 2 and 3), go to MiFit settings, and enable band visibility.
- Place miband near the phone.
- Go to xdrip Settings -> Smart watch features -> MiBand and enable option “Use MiBand”.
- Normally miband should be automatically found, and you will see a notification with your model name. If this happen, you can skip next step.
- If it wasn’t found automatically, make sure the band visibility option was enabled in MiFit, then disable “Use MiBand” option and repeat step three. You can also enter the mac addres manually (in this case, there no need for visibility option enabled).
- Now the miband should be connected, but it is required authentification. On MiBand2 and MiBand3, you should approve authentification by touching the miband button. For MiBand4 you don’t need to do anything. Normally auth key should be automatically extracted from the file /sdcard/freemyband which was generated by patched Mi Fit application. But if it was not generated, you should manually enter the key in “Auth key” field and retry everything from step 4
- Finally, you should see the message that your miband was succesfully authenticated and now you can control miband via xdrip.
3. xdrip configuration. General settings and installing glucose watchface
3.1. Configuration for MiBand4
If you use a MiBand4, you can receive a glucose readings in two ways.
- In standard miband way, using the text notifications
- Displaying glucose values on the main band screen with help of dynamical custom watchface.
- When use a text notification, xdrip would send a message to the miband after every glucose reading.
- When use a “dynamical custom watchface” the xdrip will generate a new watchface after every reading and will send this watchface to the miband. This option available only for MiBand4. All miband features would work as before. The watchface with required measurement units (mmol or mg/dl ) would be automatically installed. It would use the units from the general xdrip settings.
The option “BG readings as notification” in MiBand settings allow to controll the way you prefer to receive glucose values. When it is enable , you would receive notifications after every glucose readings. And when it is disabled, this fancy “dynamical custom watchface” would be used.
You can also enable option Send alarms to receive glucose low/hight alerts. If you enable this option, you would get bg alerts as a phone call. Instead of the caller number, you would see an alarm text with the current glucose value. During alarm notification, it is possible to push on the ignore button on you band to skip alarm or push on hangup button to snooze alert. The low/high alarms can be configured directly in xdrip general settings
It is also possible to enable night mode feature (in miband screens/ features menu) This feature allow to decrease glycose synchronisation interval by specifying interval value and mode start/end time. This mode allow to improve miband battery life by reducing synchronization frequency.
Since v 0.2.4 it is possible to display bolus on the band (if this information present in xdrip). The bolus data can be disaplyed ony when graph option enabled.
Finally to send reading to the see miband you should enable “Send reading” option
Notice1. Keep your watch nearby with your phone, while phone transmitting data (actually the real BlueTooth connection distance can be even up to 50 meters 🙂 ) If your band will lost connection with the phone while transmitting watchface, it will automatically will use default miband watchface. This watchface would be replaced again after connection would be established
2. Take a note to the bluetooth connection status and last synchronisation date to make sure you see not outdated data. Always remember to
3. The band will not accept a new watcface if battery level is less then 10%. In this case the band will automatically swith to notification mode.
3.2. Configuration for MiBand2 and 3
The only possible way to receive bg values on these band versions is to receive them as a text notification. Such notification would be sent to miband after every reading.
Xdrip miband integration apk changelog
If you like this project and want to thank an author for work done or want to support further development of features, become a sponsor on PatreonIf you have some advices regarding features that you want to see, or want to see similar feature on some specific band type, please write them in the comment of the donation form.
- Fixed App Crash at the settings screen on the first run.
Ver 0.2.4 (10.03.2020)
- New. Added option to display bolus (when enabled graph)
- Fixed issue with when BG numbers were displayed without infill
- For better readability, BG number size was slightly increased
- Added bg prediction line on the graph (would display 30 minutes prediction line)
At this moment, most of the issues were fixed, and i added many new features so I hope this would be the latest version 🙂 I have plans to merge it into the official xdrip build (if it would be accepted)
- New. Added option to disable graph on watch
- New. Added a new watchface without graph (would be used when disabled graph)
- New. Added option to collect heart rate data from miband. Update interval can be configured in MiFit or any thirdparty application. To see heart rate data in xdrip, the options “Use Health Data” and “Heart Rate sensor” which is located in Settings -> Smartwarch Features -> Smart watch sensors, should be enabled.
- Improvement. Updated graph watchface view
- Fixed. Authorisation issue on some miband 4 devices
- Syncronized with official xdrip version
Added a new options which are available only when enabled engineering mode https://github.com/NightscoutFoundation/xDrip/wiki/Engineering-Mode
- New. Added option which allow to disable hight MTU (when enabled, can fix watchface sync issues which may happen on some phones, but the watchface uploading would take much more time)
- New. Added possibility to install custom watchface. The custom watchface files ‘my_watchface.bin’ and ‘my_image.png’ should be placed into into ‘xdrip’ folder on your phone. “my_watchface.bin” is a normal watchface and my_image.png is a watchface background image. The background image shouldn’t have more than 128 colors. For faster delivery and longer battery life, the wathcface size should be as small as possible.
- New. Added offset option for custom watchface (defines offset between top of the background image and xdrip generated data)
- Improvement. Added BG update interval in night mode.
- Improvement. UI improvements on the band settings screen.
- Syncronized with official xdrip version
- Watchface. Fixed HR value when no data available.
- Watchface. Increased font size for delta and bg date.
- Fix in watchface generation algorithm which should fix “black” watchfaces reported by some users.
- Fix. Requesting higher MTU size and use the size negotiated by Bluetooth protocol. (should fix watchface synchronization issue).
- Improvement. BG alarms now work as call. On MiBand 3 and 4 the ignore button will delay alarm, and hangup will snooze alert.
- Improvement. Authentification for miband2 and 3 (no need to approve auth after disconnection).
- Improvement. Decrease brightness when uploading watchface. This can significantly improve band battery life. Also makes watchface update to be not so noticeable to people around.
- Improvement. Added night mode settings.
- Resend BG as notification if watchface cannot be installed when the battery level is less than 10%
- Quick-fix to fix a empty watchscreen and small styling issues
- New algorithm to represent glucose data, which use a dynamic watchface with a custom background. This allows using all miband features. (only for MiBand4)
- Like in previous versions, MiBand 2 and 3 can receive bg values as a notifications.