[Version 1.2] BleManagerGattCallback.nextRequest stucks after onBonded
See original GitHub issueHi,
I ran into the mentioned issue using version 1.2.0 of the library. The app is running on a Nexus 5 with Android 8.1. I’m trying to connect to a nRF52840 dongle, then bond. After bonding I want to change MTU size and write some characteristics on the device.
The flow in details:
- after device discovery, I call
BleManager.connect(BluetoothDevice) - in my
BleManagerGattCallback.initGattimplementation, I push a single bond request (Request.createBond()) into the requests queue BleManageCallbacks.onBondingRequired(BluetoothDevice)is invoked, Android pops up the Pairing notification, where I choose to pair. In the nRF Connect app, I also confirm that the pins match.BleManagerCallbacks.onBonded(BluetoothDevice)is invoked. In my implementation I enqueue a new MTU change request here:enqueue(Request.newMtuRequest(128))
The request never gets processed since the BleManager.BleManagerGattCallback.mOperationInProgress flag is still true.
I actually checked out the source of the library and modified the BleManager implementation to reset the mOperationInProgress flag to false on successful bonding in the BroadcastReceiver’s BOND_BONDED case:
Logger.i(mLogSession, "Device bonded");
mGattCallback.mOperationInProgress = false; // added this line
mCallbacks.onBonded(device);
// If the device started to pair just after the connection was established the services were not discovered.
if (mBluetoothGatt.getServices().isEmpty()) {
mHandler.post(() -> {
Logger.v(mLogSession, "Discovering Services...");
Logger.d(mLogSession, "gatt.discoverServices()");
mBluetoothGatt.discoverServices();
});
return;
}
break;
With the modifications above I managed to run the MTU change and other requests after bonding.
Is my solution valid or did I do something wrong in my intitial flow?
Thanks in advance!
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
Hi again,
Just checked the latest version (2.0.0-beta7) and the scenario I have described earlier works just fine. So I assume this ticket can be closed.
Thanks!
Looks like version 2 is out now. Should this ticket be closed now?