New issue
Advanced search Search tips

Issue 635875 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 476735



Sign in to add a comment

bluetooth: Disconnect doesn't always disconnect on Android

Project Member Reported by fbeaufort@chromium.org, Aug 9 2016

Issue description

Version: 54.0.2823.2
OS: Android 6.0 Nexus 5X

What steps will reproduce the problem?
(1) Connect to a nearby BLE device from the nRF Connect Android App (https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=en)
(2) Go to https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html
(3) Connect to the nearby BLE device by clicking "Scan" button
(4) Click "Disconnect"

What is the expected output?
BLE device should be disconnected.

What do you see instead?
It says "> Bluetooth Device disconnected" while it is not true as it is still connected from the nRF Connect Android App.

This affects workflow for Eddystone Beacon Configuration Web App (https://beaufortfrancois.github.io/sandbox/web-bluetooth/eddystone-url-config/index.html) as disconnecting device is part of the update process.


 
Status: WontFix (was: Available)
This is the opposite of Issue 630586 :)

I think it's OK to leave the connection open. Imagine a similar scenario in which instead of a beacon it's a Keyboard. You probably don't want the keyboard to stop working after you leave the page. Maybe I misunderstood something if so feel free to re open.
Yeah I know this is the exact opposite of https://bugs.chromium.org/p/chromium/issues/detail?id=630586 ;)

As we've established with https://github.com/thegecko/web-bluetooth-dfu/issues/12 (DFU), a disconnection can be an essential part of a process: Being able to respond to it (as we already do with gattserverdisconnected) and trigger it (with disconnect) should both work.

Is this "just" about adding a gattServer.disconnect({forReal: true})?
I'll try to see if there is anything we can do. But from what I understood Android ref counts the connections and disconnects when the count reaches zero. If nRF Connect is connected that count will never reach zero.
According to nRF Connect developer, this is the intended behavior on Android.

nRF Connect connects to a connected device if:
- In foreground or background (e.g. exited with home button)
- GATT server is enabled (doesn't have to have any services)
- Settings->Connectivity->Show incoming connections is enabled (default)

It's not only nRF Connect that could do that, any other app, including Bluetooth Settings for HID, as well.
To avoid it in nRF Connect make sure at least one of the conditions above is not fulfilled.


I guess I'll have to catch the non-disconnected event and warn users someone may still be holding a connection.

According to https://github.com/thegecko/web-bluetooth-dfu/issues/12#issuecomment-194183605, DFU asks for the remote side to disconnect by writing a particular characteristic. That's going to be the only reliable way to disconnect from a device from Web Bluetooth: ask the other side to physically disconnect. Calling .disconnect() only releases a refcount; it doesn't force a disconnection.
I've added a comment to https://github.com/WebBluetoothCG/web-bluetooth/issues/256#issuecomment-238843459 to discuss possibility to add a `gattserverphysicallyconnected` event.

Comment 8 by jra...@logitech.com, Aug 11 2016

`gattserverphysicallyDISconnected` event François :)

Sign in to add a comment