dkhmelenko / miband-android

Unofficial SDK for Xiaomi Mi Band
Apache License 2.0
248 stars 39 forks source link

Xiaomi Band 2 #1

Closed TwanoO67 closed 6 years ago

TwanoO67 commented 7 years ago

Hello!

Is this SDK compatible with the xiaomi band 2 ? I'm looking for classes that could achieve to send "text" on the band 2 screen

dkhmelenko commented 7 years ago

For now it's only for the first version of Xiaomi band. Support for the band 2 will be added later.

TSG9876 commented 7 years ago

Hi,

To support miband2 heart rate function you may need to add or change miband sdk from data[0]==6 add/to data[0]==0;

In the protocol coding ,original public static final byte[] START_HEART_RATE_SCAN = {21, 2, 1} only read once base on test , there are suggestion for multiple read this may be {21,1,1} for miband 2 or miband pulse.

public void setHeartRateScanListener(final HeartRateNotifyListener listener) { mBluetoothIO.setNotifyListener(Profile.UUID_SERVICE_HEARTRATE, Profile.UUID_NOTIFICATION_HEARTRATE, data -> { Log.d(TAG, Arrays.toString(data)); if (## data.length == 2 && data[0] == 6) { int heartRate = data[1] & 0xFF; listener.onNotify(heartRate); } }); }