Bonding at initialize() or reading Char that requires bond
See original GitHub issueHello again!
Thanks for you last fix, it solved my issue. 😃 I’ve ran into another strange case. Let’s say you want to connect to a device and bond that device. What is the flow for this? I’ve tried several different ways but ran into different issues.
- enqueue a bond in the initialization?
/** BleManagerGattCallback **/
override fun initialize() {
super.initialize()
createBond().enqueue()
readCharacteristic(bondCharacteristics).with(bondDataCallback).enqueue()
readCharacteristic(modeCharacteristics).with(modeCallback).enqueue()
setNotificationCallback(modeCharacteristics).with(modeCallback)
}
...
In the case above everything below createBond() will be ignored.
- read a characteristic that require bonding, and handle onBondingRequired?
override fun initialize() {
super.initialize()
readCharacteristic(bondCharacteristics).with(bondDataCallback).enqueue()
}
...
In this case I get:
E/BleManager: onCharacteristicRead error 8
It does not seem to match the BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION, see https://github.com/NordicSemiconductor/Android-BLE-Library/blob/master/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java#L1316 However, it will log in the nRF Logger: Error (0x8): GATT INSUF AUTHORIZATION.
Or is the right way to go to create a bond after connect done callback and then do additional reading for characteristics that require bond?
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (11 by maintainers)

Top Related StackOverflow Question
2.0-beta6 released.
Great! We are then almost ready with releasing it as 2.0-final. I’m just busy fixing bugs in DFU, I didn’t look there since long time… Thanks for the help with the library!