Android Bluetooth Low Energy readRemoteRssi

前端 未结 3 838
心在旅途
心在旅途 2021-02-10 02:22

I can\'t figure out how to get the \'onReadRemoteRssi\' callback work.

My code is very simple :

final BluetoothManager bluetoothManager = (BluetoothManag         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-10 02:46

    BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(deviceAddress);
    BluetoothGatt bluetoothGatt = getBluetoothGatt(device);
    
    if (bluetoothGatt == null) {
        return false;
    }
    boolean rdRemoteRssi = bluetoothGatt.readRemoteRssi();
    Log.d(FTAG, "BluetoothGatt readRemoteRssi : " + rdRemoteRssi);
    return true;
    

    It will call onReadRemoteRssi call back.Need to connect before call this API.

提交回复
热议问题