Can iOS kill an application in background in battery saving mode

Hello there,

I developed an iOS application that is connected to a BLE device.

My application has the background mode activated because I need to listen to ble events. Sometimes I put my app in background for a few hours and the app disappear from the apps in background.

Can iOS kill an application in background after some time ? Sometimes I am in battery saving mode, can it be related ?

Thank you for your response.

Replies

Yes, iOS can and will kill an application in the background if it requires resources. Not to mention the app can crash on it's own, or the device can be restarted.

You should never assume that your app will be in memory indefinitely. For apps using CoreBluetooth, the way around this is to use Bluetooth State Preservation and Restoration. This way the system will continue to monitor your pending BLE events even when you app is in terminated state, and relaunch your app when necessary.

You can read more about that here: CoreBluetooth programming guide - Performing Long-Term Actions in the Background https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW5

You will also want to check out the "Conditions Under Which Bluetooth State Restoration Will Relaunch An App" at https://developer.apple.com/library/archive/qa/qa1962/_index.html

Yes.
iOS will kill off backgrounded apps, based on various factors (which are hard to predict).
You could expect this to happen more agressivily in low power mode.

Hey. Yes. The normal background time for your app is limited but you can extend this time (unfortunately limited too). For more informations just search the internet. Best regards!

Did all these answers help you, @Yozzy?