Android-BLE-Library icon indicating copy to clipboard operation
Android-BLE-Library copied to clipboard

Trigger service discovery if interrupted in `onConnectionUpdated`

Open cwgthornton opened this issue 9 months ago • 2 comments

It appears that when a service discovery is in progress and onConnectionUpdated is called, the service discovery callback onServicesDiscovered is never invoked. By checking to see serviceDiscoverRequested is set, we can restart the service discovery and get a result back.

This may potentially fix #536, but I was seeing this behaviour consistently when connecting to another BLE device

cwgthornton avatar Feb 22 '25 23:02 cwgthornton

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 22 '25 23:02 CLAassistant

Hi! Wow, I just found this PR. It has been hanging here for 4+ months now. Sorry for that! Do you still remember anything about this issue? I think I understand it, but will need some time to do some testing.

philips77 avatar Jun 05 '25 11:06 philips77

No worries - the issue I was seeing is that it looked like sometimes I would never get onServicesDiscovered called if I got an onConnectionUpdated. While this made my connection code slightly more reliable, eventually I'd just get into a state where you had to toggle the bt adatper on/off to get it to work again (I was constantly connecting/disconnecting from devices), so I ended up pivoting away for bluetooth

cwgthornton avatar Jul 13 '25 06:07 cwgthornton