Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not disconnecting in iOS #472

Open
Deval99 opened this issue Jan 4, 2023 · 4 comments
Open

Not disconnecting in iOS #472

Deval99 opened this issue Jan 4, 2023 · 4 comments
Labels
bug Something isn't working cannot reproduce

Comments

@Deval99
Copy link

Deval99 commented Jan 4, 2023

Description
When calling BleClient.disconnect(), it resolves but doesn't actually disconnect. exiting app doesn't help, user needs to manually turn bluetooth off and wait for 7-10 seconds to actually disconnect. It is happening only in iOS, not in Android.

To Reproduce

  1. BleClient.connect(<DEVICE_1>)
  2. BleClient.disconnect(<DEVICE_1>)

Expected behavior
Actually disconnect the device, but it falsely resolves the promise and don't actually does disconnect.

Plugin version:

  • @capacitor-community/bluetooth-le: 2.1.0 (Same was happening in 2.0.1)

Desktop
OS: macOS Monterey
Browser :NA
Version : version 12.4

Smartphone
Device: iphone12 mini and iPhone 11 Pro Max
OS: iOS
Browser : NA
Version : 15.6.1 (iphone12 mini) and 15.7 (iPhone 11 Pro Max)

Additional context
Another issue i reported, Which mentioned calling BleClient.getConnectedDevices() stops notifications (it was related with callback, it was receiving notifications but failed to call callback).

Are 2 issues related internally ?

@Deval99 Deval99 added the bug Something isn't working label Jan 4, 2023
@pwespi
Copy link
Member

pwespi commented Jan 4, 2023

I don't think the two issues are related.

Could it be that the connection to the peripheral was established in another app or by the OS? In that case, a disconnect call will only disconnect the peripheral for your app, but the actual BLE connection will remain. The is the default behavior in iOS. If your app didn't establish the connection, it does not have the rights to end it.

@Deval99
Copy link
Author

Deval99 commented Jan 5, 2023

Thanks for response,

I am connecting with same app, and disconnecting. But i have to wait at least 20-22 seconds before disconnecting, or else it stays connected for remaining time. (in short, the app wants to stay connected for at least 20-22 seconds, if you do anything in the app, for example for a minute, it disconnects perfectly)

I have checked now, same issue is happening for "cordova-plugin-ble-central": "1.2.4", so it have no problem with this specific plugin. can we do anything about that ?

@pwespi
Copy link
Member

pwespi commented Jan 8, 2023

If it also happens with other apps / plugins, I don't think there is anything we can do about it.

@marcelowolfsmartindustries

I think that this issue is related with this one:
#482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot reproduce
Projects
None yet
Development

No branches or pull requests

3 participants