NordicSemiconductor / Android-BLE-Library

A library that makes working with Bluetooth LE on Android a pleasure. Seriously.
BSD 3-Clause "New" or "Revised" License
1.99k stars 414 forks source link

attachClientConnection problem on Android 10 devices. #506

Closed nadrolinux closed 11 months ago

nadrolinux commented 1 year ago

Hi, I have a problem with new attachClientConnection method. When I replace attachClientConnection by connect like in Trivia example all works fine. I use following phones: P6 - Pixel 6 (stock Android 13) P6a - Pixel 6a (stock Android 13) MI8 - Xiaomi MI8 (stock Android 10) MT - Motorola Moto E 2015 LTE (LineageOS Android 10) How to reproduce the problem:

  1. Start server on P6, P6a or MI8 (MT doesn't support Multiple Advertisement). It's irrelevant which phone I use as a server.
  2. Join all other phones to the server.
  3. Close a server via standard close.
  4. Only both Pixel phones receives onDeviceDisconnected callback. On clients like a MI8 and MT callback isn't triggered. I have to disable BT from the system menu on the server to obtain onDeviceDisconnected on MI8 and MT clients or manually disconnect clients from the server. It looks like a calling disconnect().enqueue() from the server doesn't work in some cases when attachClientConnection is used, however all disconnect calls returned Success callback. Maybe I use attachClientConnection in a wrong way and it's not a bug, however it's interesting that it works in a different way on some phones.

Cheers, Patryk

philips77 commented 11 months ago

I'm looking into that. Thank you for the report.