To set up your Mi Band 4 with Gadgetbridge you need Gadgetbridge > 0.35.0 and a unique key for your band. There are several ways to obtain the key.
Obtaining unique key
On rooted phone you may grab the key from MiFit database which means that you must:
- install MiFit
- create an account
- pair the band
Then, execute the following command in a root shell terminal:
sqlite3 /data/data/com.xiaomi.hm.health/databases/origin_db_[YOURDBNAMEHERE] "select AUTHKEY from DEVICE"
NOTICE: Every time you hard reset the band, the Bluetooth MAC Address will be changed and you must grab a new key!
On a non rooted phone you may consider using https://www.freemyband.com/ NOTE that the procedure described there is not encouraged or supported by the Gadgetbridge developers and the devs have no information on that app and whether it is safe to use
- kill or uninstall the MiFit app
- ensure GPS/location services are enabled
- unpair the band from your phone’s bluetooth (as per below)
If you already connected your Mi Band 4 with your phone remove it from Android Bluetooth settings. The procedure depends on which ROM is installed on your smartphone. Here is an example for LineageOS 16 (Android 9):
1. Once you own your unique key for your Mi Band 4 and preparations are done start Gadgetbridge, go to the home screen and tap “(+)”:
2. Allow acces to location services (required since Android 6) and Bluetooth. Start discovery:
3. After a while, your Mi Band 4 should appear. Long press on “Mi Smart Band 4”:
IMPORTANT: Enter your key prefixed with 0x ( eg. if your key is
5. Go back and tap on “Mi Smart Band 4”. Pairing should start now:
6. After successful connection you will see your Mi Band 4 on the home screen.
Congratulations, you did it!
If you encounter problems with Bluetooth discovery or pairing process, try the following steps:
- Make sure MiFit is not running
- Make sure to add 0x in from your key when pasting/typing it to Gadgetbridge
- Make sure that Mi Band 4 is unpaired from the phone
- Toggle Bluetooth OFF and ON
- Reboot your smartphone
- Reboot your Mi Band 4 (More-> Settings-> Reboot)