Background reconnection

I want my App to either be connected or attempting to connect to a known peripheral retrieved with -retrievePeripheralsWithIdentifiers or -retrieveConnectedPeripheralsWithServices. When the peripheral disconnects, re-connection should be attempted. In this way, the App receives notifications from the peripheral and presents local push notifications. This works fine when the App is in the foreground or background and still running.


In the background, if the App is killed for whatever reason (user closes, memory low) then the system disconnects the peripheral, but the App does not get notified of disconnection, so cannot reconnect automatically to continue receiving notifications. How can I attempt reconnection when the App is quit?

Replies

In order for your app to be relaunched in reponse to a Bluetooth event, you must use CoreBluetooth state preservation/restoration as described in the following section of CoreBluetooth Programming Guide: Performing Long-Term Actions in the Background


Keep in mind that this will restore your app only if it has died of natural causes like low memory jetsam. If the user kills the app, it will not be relaunched by the system until the user does it manually.

Gualtier - is there any word on dealing with all the spam here now?