android studio – Reading the heart rate of the band Mi 3

I am developing an app to measure heart rate from Mi Band 3 using the code of I do not know how to get the group's heart rate.

I am tired of editing to BluetoothGattCharacteristic, UUID and Authorization coding. But nothing works.


                private void getHeartRate () {
serviceVariable = bluetoothGatt.getService (UUIDs.HEART_RATE_SERVICE);
BluetoothGattCharacteristic heartRateCharacteristic = variableService.getCharacteristic (UUIDs.HEART_RATE_MEASUREMENT_CHARACTERISTIC);
BluetoothGattDescriptor heartRateDescriptor = heartRateCharacteristic.getDescriptor (UUIDs.HEART_RATE_MEASURMENT_DESCRIPTOR);

bluetoothGatt.setCharacteristicNotification (heartRateCharacteristic, true);
heartRateDescriptor.setValue (BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
bluetoothGatt.writeDescriptor (heartRateDescriptor);


Static UUID HEART_RATE_SERVICE = UUID.fromString ("0000180d-0000-1000-8000-00805f9b34fb");
Static UUID HEART_RATE_MEASUREMENT_CHARACTERISTIC = UUID.fromString ("00002a37-0000-1000-8000-00805f9b34fb");
Static UUID HEART_RATE_MEASURMENT_DESCRIPTOR = UUID.fromString ("00002902-0000-1000-8000-00805f9b34fb");
static final String HEART_RATE_MEASUREMENT_CHARACTERISTIC_STRING = "00002a37-0000-1000-8000-00805f9b34fb";

I can only get 0 heart rate on the mobile app. I hope that someone can help me get the heartbeat of Mi Band 3. Thank you.