Pixel phones fail to disconnect

We are experiencing a problem with our app, using nRF5_SDK_17.1.0_ddde560:

It works fine with Galaxy S20, but on Pixel phones (we tried 4, 6 and 7) it fails to disconnect.

In order to understand if the problem was due to our firmware or App, we tried with a Pixel 4 connected with the nRF52840 demo board running Peripheral UART demo (using the binary image downloaded from your site) and the nRF Toolbox (3.1.3) on a Pixel 4, replicating the problem.

Besides the Galxy S20 fails to connect to the Peripheral UART demo using nRF Toolbox.

Can you suggest any patch to fix the disconnect fail problem?

Parents
  • Hi Carlo, 

    Could you explain what you meant by "failed to disconnect" ? Could you give some more detail ? 

    When testing please make sure to remove any bond information on the phone and do a errase all on the chip as well. 

    You may also want to get familiar with the Bluetooth Sniffer it can be very helpful to debug the problem. 

  • With 'Failed to disconnect' I mean that even closing the App,:

    • The LEDs on the device remain in the 'Connected state'
    • The device is not advertising

    If I either:

    • Isolate the phone (double conductive box enclosure in another room) or
    • Cycle the device power

    The advertising can be see again.

    This is similar to the behaviour on our device, where I can see in the log that the phone has not disconnected.

  • I have switched to the most recent SDK to make things easier to replicate:

    Downloaded nRF Connect SDK v2.4.0
    Built Zephyr Heartrate Sensor for nRF52840 DK NRF52840
    Loaded PCA10056 - nRF52840-Preview-DK
    On the Mobiles I am usingmRF Toolbox 3.1.3

    The behaviour is still the same.

    Just an additional note: everything works fine with the Galaxy S20 if I pair the device first.

  • I have this dump (Using Ozone):

    Connected
    [00:00:30.146,087] \033[0m<inf> hrs: hrmc_ccc_cfg_changed: HRS notifications enabled\033[0m
    [00:00:30.236,022] \033[0m<inf> bas: blvl_ccc_cfg_changed: BAS Notifications enabled\033[0m
    [00:00:54.940,826] \033[0m<inf> bas: blvl_ccc_cfg_changed: BAS Notifications disabled\033[0m
    [00:00:54.940,887] \033[0m<inf> hrs: hrmc_ccc_cfg_changed: HRS notifications disabled\033[0m
    Disconnected (reason 0x13)

    But the last line only appears after I disable Bluetooth on the Pixel.

  • Hi Carlo, 

    Please be aware that when on the app on the phone if you click disconnect from the app, it doesn't mean that the phone will disconnect right away. 
    The normal behavior is that the phone (Android OS) checks for any service/app that still use the peripheral. If there is no app/service that uses the peripheral it will disconnect. 

    What I want to say here is that click disconnect from the app will not terminate the connection immediately. 

    If in your test, you turn off Bluetooth or bring the device out of range and you can see Disconnect event, then it's working fine. 
    You can verify the behavior by using a sniffer . 

  • From a technical viewpoint what you say makes perfectly sense.

    As a user experience this situation is terrible; for example, using an HRM:

    1. I start a first session of exercises.
    2. I interrupt the app for some reason
    3. To be able to reconnect I need to disable and reenable Bluetooth on the phone; because I can only connect on the advertising and the device is not advertising because it is already connected.

    We will try to force a disconnect from the BLE device side, the alternative being telling the user that Pixel phones are not supported.

    A solution disabling and reenabling Bluetooth from the App is no longer feasible, because this requires notifying the user.

    I understand that this is a problem caused by the Pixel mobiles, not by Nordic.

  • Hi Carlo, 
    I'm not a Android developer, so I don't know exactly if it's possible. But can you get the list of connected devices from the app ?

    If you can, you can show them in addition to the ones which are advertising. 

    I did a quick check here with a Pixel 7 and it can disconnect just fine, so maybe it's the issue on some specific phones or that phone in particular ? Could you check if you can remove some service which may hold the connection ? Maybe try to test after a fresh restart of the phone (or factory reset if possible) and use nRF Connect app to connect then disconnect ? 

Reply
  • Hi Carlo, 
    I'm not a Android developer, so I don't know exactly if it's possible. But can you get the list of connected devices from the app ?

    If you can, you can show them in addition to the ones which are advertising. 

    I did a quick check here with a Pixel 7 and it can disconnect just fine, so maybe it's the issue on some specific phones or that phone in particular ? Could you check if you can remove some service which may hold the connection ? Maybe try to test after a fresh restart of the phone (or factory reset if possible) and use nRF Connect app to connect then disconnect ? 

Children
  • After a Factory Reset the Pixel 4 works fine. We will monitor if it keeps working fine.

    We have tried the APIs that list connected devices, but they report no connection even if the device seems connected.

  • Thanks for the info. I will forward your case to our Android developer and check if they have any comment. 

  • Hello,

    I can add 2 things to what Hung said.

    To get connected devices you have to open a GATT Server (the API is in BluetoothManager). You don't have to add any services. When opening a GATT Server you'll be providing a callback handler. One of the method there will be involved each time a new BLE device connected. It will also initially be called with existing connections.

    The app to get connected devices may only with fire classic Bluetooth devices.

    Another thing is about disconnecting. We never had issues with that on any of our phones, including Pixel. Remember that the physical link will be terminated only when the last BluetoothGatt object is disconnected. There may be multiple such objects connected to one device on one or more apps.

    To make sure the device disconnects you would have to create an op code for that on the device side which you'd send to trigger disconnection from the phone.

Related