Tech R&D: Background location tracking

Foreground and background tracking

Many mobile apps respond to the user’s movements by showing information relevant to their changing location. For example, the Curzon Memories app which preceded the City Strata project displays multimedia memories as the user walks the streets around the eponymous cinema, and the Guardian’s Streetstories app provides a rich geo-activated soundscape in Kings Cross. However, like other examples of this type, both apps only work when they are visible on the phone’s screen - in the “foreground” as it is known. If the user starts a second app on the phone to, say, check their email then the current foreground app is moved to the “background”. What happens next depends a little on the mobile phone platform but, essentially, the app stops operating unless special conditions have been met. More on that in a moment.

The scenario envisaged for City Strata requires a different mode of operation in which a user’s location is still monitored while the Cinemap app is in the background, for example while the user is running a different app or when the phone is not actively in use at all. That’s a requirement shared with other app scenarios such as location-based marketing, but there is a snag. Although location tracking is one of the special conditions for background processing on iPhones, for example, its use is quite restricted, and for good reasons.

Location accuracy and battery usage

Mobile phones use a combination of three methods to determine their (and hence the user’s) location:

  • GPS - the phone receives signals from the worldwide network of Global Positioning Satellites and works out its location every second to around 10m under good conditions (for example in the open air and away from tall buildings).

  • WiFi - the phone detects nearby WiFi base stations and compares the resulting pattern to a database of known locations. Accuracies of around 100m might be expected in urban areas with lots of WiFi.

  • Cell Tower - very similar to the WiFi method except that the phone uses the cell transmitters at the heart of their particular mobile network. Because these are much more sparse than WiFi base stations, the achievable accuracy is around 1000m.

Broadly speaking, GPS is an order of magnitude more accurate than WiFi and two orders better than Cell Tower positioning, so why would the other two approaches ever be used? The answer lies in their differing power requirements. GPS tracking requires special circuitry in the phone which can drain its battery in just a few hours. For a foreground app like Curzon Memories, that’s fine. The user knowingly chooses to run the app and is likely to use it only for a limited time. They can monitor how their battery is faring and quit the app if necessary. However, background location tracking is intended to operate without the user’s attention until a notable location is detected. While GPS can be used on an iPhone in the background, there is a real risk that it might cause the user’s phone to run out of power without the responsible app appearing to do anything at all. That is very unlikely to recommend the app to the user or their friends.

Cellular positioning, on the other hand, requires no extra power from the battery. Phones must connect to cell towers anyway to maintain connection to the network, and the location algorithm can easily piggy-back on this core activity. That makes the app a much better citizen with regard to battery life and the user’s overall experience, though at the cost of lower accuracy and responsiveness. As a result, it is Apple’s recommended approach to background location tracking, implemented through the iOS Significant Location Change service.

Experimenting with the Significant Location Change service in iOS

The Significant Location Change service allows iPhone apps to register for notifications when the user’s location is determined to have significantly changed (no surprises there!). Apps that are in the background (suspended or terminated) when the notification arrives are re-launched to handle the user’s movement. They only have a short period to process the notification and may not change the user interface, though there are ways to request extra processing time and to request the user’s permission to raise the app to the foreground.

The service uses cellular positioning to detect significant movements. The limitations of this approach can be seen in the map below in which the red line represents a bus journey of around 5km and the markers represent locations notified to a test app by the significant location change service. As may be seen, only three locations around 2-3km apart are reported to the app during the 40 minute journey.

 

In the second map below, the blue line represents a walk of around 1.4km in the centre of Bristol and the marker represents the only location that the service reported to the app during the test. In effect, the test app thought that the user was stationary in Queen Square throughout the walk. 



These findings, reinforced by others we and others have collected, rule out using the significant location change service as the sole positioning mechanism for Cinemap, which requires much finer grain detection of the user’s location. We’ve already shown that using GPS positioning for background positioning is equally unattractive, so how might a more subtle approach be provided?

Towards a more flexible approach

In Cinemap, we want to combine the low-power qualities of cellular positioning and the fine-grain accuracy and latency of GPS. We should also leverage the intermediate characteristics of WiFi positioning where appropriate. The basic strategy is to switch between different positioning technologies as the user approaches locations of interest. To do that, we distinguish between three modes of background location tracking:

  • orienting mode - in which the objective is to detect in the background that the user has entered a large geographical area that might contain locations of interest to the user. For example, the Cinemap app might need only to detect that the user has entered central Bristol where situated cinema memories are known to exist.

  • monitoring mode - in which the app begins to monitor the user’s location more closely but still with a strong emphasis on power saving. The aim is to detect that the user is sufficiently close to situated memories to switch into the triggering mode.

  • triggering mode - in which the app temporarily uses fine grain positioning to detect the user’s arrival at a location of interest and to trigger the associated memory (by notifying the user of its availability).

The outer modes - orienting and triggering - correspond well to cellular positioning and GPS tracking respectively. The design challenges are to find an appropriately mixed strategy for the monitoring mode and good heuristics for switching between the modes.

On iOS, the monitoring mode will specify fairly coarse accuracy and refresh requirements to the underlying location services in order to engage WiFi positioning rather than GPS tracking. However, it remains unclear exactly how the location system will respond to such requirements. For example, it may be that GPS circuitry is permanently activated even though an app has only requested location updates every 10 seconds or so. On Android, we are likely to have more direct control over the behaviour of the location services but the basic constraints still apply - the finer grain of the location tracking, the quicker the battery will run down.

Obviously, the switching algorithm cannot directly exploit the current distance to situated memories because that implies the very location information that we are trying to track. Instead, the algorithm will use a zoning approach to identify local areas in which a finer-grained mode is justified. Even then, the finer-grained modes may need to be time-limited to avoid battery problems when a user remains in a zone populated with situated memories but does not approach the memory locations themselves. Of course, such timeouts then risk the user arriving at but missing a significant location after the reversion to a coarser mode...

Overall, the design, implementation and - crucially - testing of such a mixed approach to background location tracking is beyond the scope of the current City Strata project. We will demonstrate aspects of the approach but a full integration into the Cinemap app must wait for a follow-on project.

Top