cordova-plugin-ble-central icon indicating copy to clipboard operation
cordova-plugin-ble-central copied to clipboard

The connectCallback of ble.connect() always got called not matter if it's really connected when first pairing

Open qiluo opened this issue 6 years ago • 1 comments

When my app was trying to connect a new device, there was a system message "The xxx would like to pair with your iPhone", you can choose "Cancel" or "Pair" then.

If click "Pair", everything was fine.

If click "Cancel", the both connectCallback and disconnectCallback got called, first connectCallback then disconnectCallback

I'm on plugin 1.2.2 and iOS

qiluo avatar Sep 18 '18 13:09 qiluo

Pairing isn't well supported. If the plugin can create a peripheral object, it calls the success callback.

https://github.com/don/cordova-plugin-ble-central/blob/f2d42938a7ffb608e811fa60afffc349fc14a6cf/src/ios/BLECentralPlugin.m#L73

Then when you cancel pairing it disconnects.

Hopefully your app can work around this for now.

don avatar Oct 18 '19 01:10 don