question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose transport and phy configuration for connection (Android 10 connection issue)

See original GitHub issue

Hey,

Android 10 introduced problems with connecting to multiple BLE devices for me. Linked topics may be related: https://stackoverflow.com/questions/58299507/android-10-ble-connection-issue https://issuetracker.google.com/issues/141188862

I managed to find solution by forcing this config on connection:

bluetoothDevice.connectGatt(
                context,
                false, // auto connect set to false
                connectCallback,
                BluetoothDevice.TRANSPORT_AUTO,
                BluetoothDevice.PHY_LE_CODED
            )

But RxAndroidBle don’t exposes possibility to set transport and phy. Have you considered exposing those settings?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mtomczynskicommented, Nov 19, 2019

@dariuszseweryn problem has been fixed from the bluetooth device perspective. I think it’s really interesting case. Straight after bonding device didn’t update it’s address type immidiately to correct type (random static) but kept the incorrect (public) one. Address itself was correct.

These are white list operation with bug:

  1. Add to white list: type PUBLIC, address true private // First connection after bonding
  2. Add to white list: type RANDOM, address true private // All subsequent connections

These are white list operation with fixed address type:

  1. Add to white list: type RANDOM, address true private // First connection after bonding
  2. Add to white list: type PUBLIC, address current public random address // All subsequent connections

Here’re logs with solution if you’re interested: btsnoop_working.log logcat_highlights.txt

What is most interesting about it, is that this situation is tolerated by all iOS versions and Android version until 10. It appears that they dramatically changed how addresses are handled under the hood.

1reaction
dariuszseweryncommented, Nov 18, 2019

Scanning itself is not full story, if I successfuly scan the devices, then turn off bt for a while and try to connect to them without doing second scan (BluetoothDevice from bonded list), connection is successful.

This is a well-known bug of Android. I have briefly mentioned about it on Wiki

You’re right, the device won’t always pop up in the scans, maybe it’s scanned with true random address and is interpreted by something up in the stack. But still after the scanning it’s added to white list with random type address.

I have been looking on frames between 4531 and 6017. First one is the last moment the peripheral is added to white list with public address type and the second is the first moment the peripheral is added to white list with random address type. I have tried searching for MAC address c5:c1:c4:74:61:88 but have not found it in between. That would suggest that the Android stack has some bug not directly related to this peripheral scan.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expose transport and phy configuration for ... - GitHub
It happens only when there are multiple bonded devices and only on Android 10, only thing that helps is clearing list of bonded...
Read more >
Troubleshoot network issues | Android Developers
This topic shows you how to monitor and categorize your network traffic, ... your data transfers and the amount of data transferred during...
Read more >
A Practical Guide to BLE Throughput | Interrupt - Memfault
Connection Event - For BLE, exactly two devices are talking with each other in one ... Android also exposed APIs as part of...
Read more >
Setting Up Your Android Device For Development
Inside of the Windows Command Prompt, input adb devices and then press the Enter key to display all connected Android devices. ADB_Devices.png.
Read more >
Ethernet PHY Configuration Using MDIO for Industrial ...
Ethernet applications on custom boards with migration and troubleshooting guides for the PHYs [1] [2] [3]. Table of Contents. 1 PHY Selection and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found