3

I am new to Android Bluetooth LE and wearables and trying to develop an app to get heart rate from wearables. I am using a Mi Band 3 and following Google’s docs to get heart rate from nearby BLE device(Mi Band 3). I am unable to discover the device. I am using the following code as a reference.

callback = new BleScanCallback() {
        @Override
        public void onDeviceFound(BleDevice device) {
        //    ClaimBleDeviceRequest request = new ClaimBleDeviceRequest(mClient,device);

            PendingResult<Status> pendingResult =
                    Fitness.BleApi.claimBleDevice(mClient, device);
        }
        @Override
        public void onScanStopped() {

            // ..
        }
    };

    StartBleScanRequest request = new StartBleScanRequest.Builder()
            .setDataTypes(DataType.TYPE_HEART_RATE_BPM)
            .setBleScanCallback(callback)
            .build();

    PendingResult<Status> pendingResult =
            Fitness.BleApi.startBleScan(mClient, request);
Achilles
  • 250
  • 5
  • 13

1 Answers1

0

Have you tried regular BLE api? https://developer.android.com/guide/topics/connectivity/bluetooth-le

If the device is not discovered with the regular BLE api, but its discovered by the companion device, then you might try regular Bluetooth API - the LE might not be supported by device.

promanowicz
  • 399
  • 2
  • 10