Android-BLE-Library: Failing to connect after upgrading to Android 13
Hi!
On a One plus 8T device running Android 13, it simply won’t connect to the BLE peripheral
Here are the logs from BleManager and the app is always timing out after initiating a service discovery.
12-12-2022 12:16:12.038-0500 D | BleManager: gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 2M)
12-12-2022 12:16:12.110-0500 I | BleManager: Connected to D4:D5:BE:82:CE:31
12-12-2022 12:16:12.110-0500 D | BleManager: [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
12-12-2022 12:16:12.113-0500 D | BleManager: wait(300)
12-12-2022 12:16:12.115-0500 I | BleManager: MTU changed to: 247
12-12-2022 12:16:12.415-0500 V | BleManager: Discovering services...
12-12-2022 12:16:12.416-0500 D | BleManager: gatt.discoverServices()
12-12-2022 12:16:12.776-0500 I | BleManager: Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
12-12-2022 12:23:07.385-0500 D | BleManager: [Callback] Connection state changed with status: 8 and new state: 0 (DISCONNECTED)
12-12-2022 12:23:07.388-0500 W | BleManager: Error: (0x8): GATT CONN TIMEOUT
Here is the connect code:
fun connectDevice(bluetoothDevice: BluetoothDevice) {
val request = connect(bluetoothDevice)
.useAutoConnect(false)
.usePreferredPhy(no.nordicsemi.android.ble.PhyRequest.PHY_LE_2M_MASK)
.retry(3, 100)
.enqueue()
}
The device was able to connect successfully while it was running Android 12 but as soon as you update it to Android 13, it fails to connect.
Details: Device: One plus 8T OS: Android 13 (KB2005_11_F.13) Library version: v2.5.1
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 28 (5 by maintainers)
This is being reported by more of our users!
To add more context we manufacture custom wearable, PCB of which are based on Nordic designs. On Android 13 certain devices are failing to connect with these wearables. The logs of these are mainly of two types, one where there is an instant disconnect after connection (pretty much similar to the one @SarthakJ10 has posted) the other type being services not being discovered after connection.
We initially thought this was some bond management issue happening for users who are bonded while on Android 12 and after the OS update to Android 13 the connection was failing. However this is not the case. For a user on Android 13 and trying to connect to our peripheral for the first time this happens as well. Even the blinky sample project fails to connect with the phone.
On the same device we started our test while to Android 11 -> Android 12-> Android 13. It works as expected on Android 11 and Android 12.
Tested on
Device: One plus 8T (Model KB2001) OS: Android 13 (KB2001_11_F.13) Library version: v2.5.1
Please let me know if you would need any more specific central or peripheral side logs.
We managed to reproduce the issue on our side with OnePlus 8T and are investigating. Neither nRF5 SDk nor NCS support Read Multiple request, but the central should not continue after getting Not Supported error.
@philips77 Thank you! Yes I did try on Pixel 7 running Android 13 and I have no issues on that phone.
So we tried a sample project (based on nrf connect sdk instead of nrf softdevice) and it works as expected on the One Plus 8T device. Connection works and services are getting discovered. Although I am not sure what this means and where the solution would lies.
Related discussions on the Nordic Q&A Forum
Here are the sniffer logs. I have multiple attempts to try and connect to the BLE peripheral and the first one is where bonding happens. withBonding.pcapng.zip