Android-BLE-Library: autoConnect stopped working since graduating from pre v1.0 to 1.2
Hi,
My app connects to a sensor which occasionally (after 30 seconds of no use) switches off. When switched off, the phone should continue to try to reconnect to it, so that the moment the sensor turns back on it seamlessly reconnects.
I have had this app released (with >200 users) for some time using the version before it was released on Maven. This behaviour has been working perfectly with the old version of this library.
Since upgrading to V1.2 over the weekend, my app no longer reconnects (I have confirmed that the sensor is actually turned on). It looks like the initial connection using autoConnect = false works perfectly, but after the sensor has then turned off, and back on again (so now connecting with autoConnect = true), no connection is made. I have made no changes since upgrading to V1.2 (except importing the new Request class) - am I doing anything wrong?
I have NRFLogger running with some debug messages on the BLEManager callbacks. A typical debug output looks something like this:
onDeviceConnecting
gatt=device.connectGatt(autoConnect = false)
onDeviceConnected
onServicesDiscovered
Notifications Enabled
onDeviceReady
Notification Received
... (lots of notification received - 1 every second. This is normal usage)
Notification Received
Connection state changed with status : 8 and new state: 0 (DISCONNECTED)
Error: (0x8): GATT CONN TIMEOUT (this is expected - the sensor has gone to sleep now)
Connection Lost
onLinkLossOccur
onDeviceConnecting
gatt.connect()
(at this point the sensor is turned on, advertising and available for connection - but app doesn't connect)
Currently this version of my app has not been released, and has only been tested on my Pixel 2 development phone - but seems consistent behaviour.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (9 by maintainers)
Hi,
Thanks for the update! I haven’t migrated to the beta versions of the library yet, but have been following the progress closely. Will update to beta5 when its available and let you know how I get on. Great work btw - this library really does make Android BLE much simpler and reliable.