BLE on Android 9

I tried to test the TI SensorTag with the LightBlue app, but it was not able to scan.

Is BLE not working on Android 9?

When I turned on location, I was able to scan it.
However, when I try to connect, I get an error 133.

2020-09-07 19:37:59.801 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(948)] GATT_Register 0d2a284f-1999-64ae-1497-f79ca3bc3064
2020-09-07 19:37:59.801 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(968)] allocated gatt_if=5
2020-09-07 19:39:11.128 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(948)] GATT_Register 60b5bab6-2ff8-1f33-2221-5076b7c676c9
2020-09-07 19:39:11.128 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(968)] allocated gatt_if=5
2020-09-07 19:39:24.844 3743-3743/no.nordicsemi.android.mcp D/BluetoothGatt: connect() - device: 54:6C:0E:80:87:83, auto: false
2020-09-07 19:39:24.844 3743-3743/no.nordicsemi.android.mcp D/BluetoothGatt: registerApp()
2020-09-07 19:39:24.844 3743-3743/no.nordicsemi.android.mcp D/BluetoothGatt: registerApp() - UUID=4565437d-7df5-4c5a-b35d-3d315a1dab9a
2020-09-07 19:39:24.848 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(948)] GATT_Register 3a0acb7d-8e06-811c-5d4b-517e5df381f2
2020-09-07 19:39:24.848 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(968)] allocated gatt_if=5
2020-09-07 19:39:24.849 3743-3755/no.nordicsemi.android.mcp D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
2020-09-07 19:39:24.852 586-968/com.android.bluetooth I/bt_stack: [INFO:gatt_api.cc(1109)] GATT_Connectgatt_if=5 54:6c:0e:80:87:83
2020-09-07 19:39:54.853 586-968/com.android.bluetooth W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=3 connected=0 conn_id=0x0003 reason=0x0100
2020-09-07 19:39:54.853 586-968/com.android.bluetooth W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=4 connected=0 conn_id=0x0004 reason=0x0100
2020-09-07 19:39:54.854 586-968/com.android.bluetooth W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=5 connected=0 conn_id=0x0005 reason=0x0100
2020-09-07 19:39:54.854 586-968/com.android.bluetooth W/bt_stack: [WARNING:bta_gattc_act.cc(339)] bta_gattc_open_fail: Cannot establish Connection. conn_id=0. Return GATT_ERROR(133)
2020-09-07 19:39:54.858 3743-3755/no.nordicsemi.android.mcp D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=54:6C:0E:80:87:83

I’ve analyzed the HCI snoop log for BLE in WireShark.

Is it possible that this is not being successfully notified by the device after Create Connection?

1037	14.774880	host	controller	HCI_CMD	29	Sent LE Create Connection
1038	14.776644	controller	host	HCI_EVT	7	Rcvd Command Status (LE Create Connection)
1039	14.949549	controller	host	HCI_EVT	34	Rcvd LE Meta (LE Enhanced Connection Complete)
1040	15.949521	controller	host	HCI_EVT	7	Rcvd Disconnect Complete
1041	44.775156	host	controller	HCI_CMD	4	Sent LE Create Connection Cancel
1042	44.777801	controller	host	HCI_EVT	7	Rcvd Command Complete (LE Create Connection Cancel)

It connected well with Android 10.
What’s the difference?

I’m starting to focus on that now.

https://github.com/NordicSemiconductor/Android-BLE-Library/issues/53,
This could be an android9 stack error.

You can try to do all your BLE operations on UIThread.

1 Like

Thank you.

I’m currently considering using Android 10, which is working properly.
If I ever get it running on Android 9, I’ll give it a try.