cordova-plugin-ble-central
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
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
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.