Skip to content

BleClient Becomes Non-Responsive (Hangs Indefinitely) #734

Open
@wittigtech

Description

@wittigtech

Describe the bug
After successfully connecting and disconnecting, the next connection attempt causes the plugin to hang indefinitely. After the subsequent BleClient.connect(), the following call to BleClient.startNotifications() never resolves. Instead, after a brief pause onDisconnect callback is triggered. At this point, the plugin functionality is not recoverable. Attempting a connect() retry (or call to any BleClient function) results in no response. When in this state, the only resolution seems to be to restart to application.

To Reproduce
Steps to reproduce the behavior:

  1. Call BleClient.connect() to establish connection to a device
  2. Call BleClient.startNotifications() to listen for changes of a characteristic
  3. After satisfied with successful connection, call BleClient.stopNotifications() to stop listening
  4. Call BleClient.disconnect() to disconnect from device
  5. Up until here, there are no issues. At some point, a user wants to connect to another device or same device, so the steps are repeated.
  6. Call BleClient.connect() to establish connection to a device
  7. Call BleClient.startNotifications() to listen for changes of a characteristic <- this never resolves
  8. onDisconnect callback is triggered without any error, bluetooth-le plugin is non-responsive at this point

Expected behavior
Functions for Connect, StartNotifications, StopNotifications, Disconnect should work consistently across supported Android devices.

Plugin version:

  • @capacitor-community/bluetooth-le: 2.3.0

Smartphone (please complete the following information):

  • Device: Google Pixel 7 Pro
  • OS: Android 15

Additional context
This issue does not affect all Android devices. The following devices reproduce this bug fairly consistently:

  • Google Pixel 7 Pro Android 15
  • Microsoft Surface Duo Android 12

The following devices work as expected:

  • Samsung Galaxy S21 Android 14
  • Samsung Galaxy S9+ Android 10
  • Samsung Galaxy Tab SM-T720 Android 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidImpacts the Android platformbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions