Android Bluetooth Low Energy: characteristic.getPermissions() returns 0?

前端 未结 1 453
再見小時候
再見小時候 2021-02-04 17:56

I am writing an Android BLE application, and I am trying to get the permissions of a certain characteristic. I have already managed to get the characteristic properties with cha

1条回答
  •  再見小時候
    2021-02-04 18:23

    This looks like an issue with the underlying framework. This link shows the block of code that the framework executes when discovering services/characteristics on the remote device. You can see when the new BluetoothGattCharacteristic is created, the permissions parameter is always passed in as 0.

    Additionally, even when the characteristic is later read, only the characteristic's value is updated, no other parameters are reset on the object.

    Instead, it seems Android attempts to handle authentication/permission issues on a trial and error basis. In other words, the framework always attempts a basic read/write, and if it fails for authentication reasons, it automatically tries again with MITM authentication requested.

    0 讨论(0)
提交回复
热议问题