Please, I need a clarification regarding: Understanding When Your App Gets Launched into the Background

Please, I need a clarification regarding:


App Programming Guide for iOS

Background Execution

Understanding When Your App Gets Launched into the Background

Apps that support background execution may be relaunched by the system to handle incoming events. If an app is terminated for any reason other than the user force quitting it, the system launches the app when one of the following events happens:

For location apps:

  • The system receives a location update that meets the app’s configured criteria for delivery.

...

In most cases, the system does not relaunch apps after they are force quit by the user. One exception is location apps, which in iOS 8 and later are relaunched after being force quit by the user. In other cases, though, the user must launch the app explicitly or reboot the device before the app can be launched automatically into the background by the system. When password protection is enabled on the device, the system does not launch an app in the background before the user first unlocks the device.


How can I try ? How do I restart the app according to what I read ? Thanks a lot for availability


Massimo Senatore

Firenze Web Division

Italy

Replies

When a user force quits an app, the system accepts this as a signal that the user no longer wishes this app to be running, also in the background.

There are a very limited number of cases in which an app will be relaunched after a force quit.


For location apps, this case is Region Monitoring. Only if your app is a Region Monitoring app, you can expect it to be relaunched consistently after the user force quits it. None of the other location services can be relied on to have your app re-launched after a force quit.


If you want to test this behaviour for a Region Monitoring app, the test is simple. You can just force quit the app, and confirm that the app will be relaunched. For example, you can post a local notification when you receive a region update and confirm whether you are seeing a notification even after force quitting the app.


To test the alternate condition for other location services, that your app is going to be relaunched after it has been terminated by the system, you will need to find a way to terminate your app without force quitting it.


A quick way for testing purposes is to call exit(0) in your code. This will terminate your app, and then you can confirm whether the app is relaunched or not under various conditions, and based on the various location services being used.


Do make sure to remove this code after your testing is completed, as apps that abort using this technique may be rejected by App Review.

  • Also if you debugging the app with Xcode you can just press "stop" in Xcode to quit the app. It also doesn't count as force quitting.

Add a Comment