don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

Document best practices on iOS #974

Open peitschie opened 11 months ago

peitschie commented 11 months ago

Spawned from discussion on #963

The best approaches found on Android are:

  1. Use autoConnect and don't explicitly scan (i.e., let the OS schedule this itself) (in iOS, autoConnect is implemented purely in the JS layer, and is identical to approach 2)
  2. Explicitly scan and then use connect
  3. (Maybe) for a non-bonded device, it's safe to just use connect without an explicit scan (to be confirmed)

Additional things worth documenting:

  1. Handling Bluetooth authorization
  2. Known quirks regarding isEnabled state
  3. Background processing vs Restore state

Documenting the known caveats and quirks would help implementors more effectively use this plugin.