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.

ConnectionObserver.onDeviceDisconnected() can never report REASON_TERMINATE_PEER_USER

See original GitHub issue

ConnectionObserver.onDeviceDisconnected() always reports REASON_LINK_LOSS even if the peripheral initiate disconnection with BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION. Expected to report REASON_TERMINATE_PEER_USER in that case.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rickymohkcommented, Apr 22, 2021

The behavior could keep the same, but at least give a way for developer to differentiate whether the connection is initiated by the peripheral, in case that information is necessary for the App to determine what to do. In my case, I want to auto reconnect my peripheral if it is disconnected due to let say out of range, but stop auto reconnect if the peripheral explicitly initiates disconnection (e.g. there could be an unpair button or a factory reset button on the peripheral) . Even if the phone keeps auto reconnecting, at least I can write my own code to explicitly call disconnect().enqueue() if I know the disconnection was intentionally initiated by the peripheral.

0reactions
cocomeneaucommented, Sep 12, 2022

The problem describe by @rickymohk still exist on some devices (with Android-BLE-Library v2.3.1). I’m using a Redmi note 7 (Android 10) I got no problems but with a Samsung Galaxy S20 (Android 12) I always have REASON_LINK_LOSS when my BLE device perform a disconnection. I also tried with the last version of the Android-BLE-Library (v2.5.1) and it’s the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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