Bluetooth data retrieval on iOS, even when the app is closed or killed.

Any idea to achieve reliable periodic Bluetooth data retrieval on iOS, even when the app is closed or killed.

There is a feature called Bluetooth State Preservation and Restoration where the system will continue a BLE connection or some other BLE functions on your behalf if the app is terminated due to OS constraints. When you have implemented this, the system will relaunch your app when key CoreBluetooth events happen and the system needs your app to continue. For example, if your app is connected to a BLE peripheral, and then gets terminated, when the peripheral disconnects, they system will launch your app in the background and will call the appropriate CoreBluetooth callback function.

There are some limitations to this though. For example if the user terminates the app by swiping it off, then your app will not be restored. TN3115: Bluetooth State Restoration App Relaunch Rules explains when your app may or may not be relaunched.

While all this will allow your app to react to BLE events from the peripheral you are trying to retrieve data from, the solution here is to have the peripheral send the data periodically. It is not possible for an app to periodically retrieve data (or do much of anything) when it is closed or killed.

To learn about the limitations of things you can do when your app is not active, you may want to read about iOS Background Execution Limits


Argun Tekant /  DTS Engineer / Core Technologies

Bluetooth data retrieval on iOS, even when the app is closed or killed.
 
 
Q