A mandatory feature of any tracking app will be to compute the users' geolocation in the background (typically, when the smartphones' screen is turned off/blocked). iOS may kill running applications to increase battery life once the screen is turned off or if they enter background mode. This is only desirable if the application is intended to only run in foreground (e.g. wayfinding applications), but will cause inconveniences in all other cases (e.g. tracking apps).

iOS apps that integrate Situm SDK will be able to work safely in the background with just a couple of configurations: Situm takes care of everything.  


How does Background execution work in iOS?

iOS distinguishes two background operation modes:

  1. Finite task background executionThis mechanism allows to finish long tasks, which cannot be interrupted, when the app goes to background. This execution mode imposes restrictions when an app takes too long to complete those tasks or makes excessive use of this mechanism (e.g. may kill the app in this case).
    • This mode is viable, for instance, if we want to keep computing the user geolocation for some seconds/minutes after she blocks the screen.
  2. Background mode. This mode allows to keep the application running in the background forever (or at least, for long periods of time).

Obviously, the "Background Mode" is the recommended to build tracking apps: allows us to compute the geolocation of the user at all times. There are a number of cases in which the use of this mode is allowed in iOS, including positioning and guidanceBy  activating the required permission at the app level, it is possible to compile an app that uses Situm and keeps the positioning in the background. 

This solves the problem from a technical perspective. Nevertheless, from an operational perspective it is important to take into account that Apple must aprove the distribution of the app in the App Store. Specifically, Apple must allow the use of this permission. Apple evaluation includes, among other things, a validation of the reasons why the app wants access to the user's position.  

As an alternative, in case this approval results problematic, would be to use an Enterprise App Store. This option will probably have a less extensive evaluation of the apps, but a number of requirements must be met in order to become a member of this program.


Does the Background Mode have limitations? 

With the second option, an app using our SDK will be processed in the same background as, for example, a mail app. When the battery saver mode is activated, the system can limit partially its functionality, but in principle it should not reach the point that Situm positioning stops working acceptably. In any case, this is totally at the mercy of the specific device, system-operational and its battery saving policies.


How does the battery saver affect background execution?

The Operating System might introduce discretional limitations to the background execution of the app, reducing its performance or even killing it. There is not much information available regarding these conditions about under which conditions the system may decide to limit the operation of the app or even kill it (iOS: 11 continuous background location update by swift ). An important factor will be the battery consumption of the app: the higher it is, the higher the change the OS might kill it. This is specially true if the "Battery Saver" mode of the OS is activated.

What seems assured, is that an app will not be able to run in backgrounds for days without the system eventually closing the app. To alleviate this, there are mechanisms associated with the Background Mode that allow an app to be launched in response to certain events. See the article "About the background execution sequence"  for more information.


Would it be possible to relaunch the app if the system or the user closes it?

Yes, but only if the app has the Background Mode permission activated.  We can react to three types of events

(Handling location events in the backgroundin order to relaunch the app:

Will the user notice that the app is running on the background?

Yes. In all iOS systems the use of background location shall be marked by an indicator on the system bar at the top. Additionally, in iOS 13 and later, the use of background location can launch a popup to show the user the last positions obtained and confirm that he wants to continue allowing that access to the location in the background. This warning can show up repeatedly, and it is up to the iOS system to decide when to launch it.