Our open-source iOS SDK collects anonymized, aggregated, ambient location data. While a Mapbox-powered application is running in the background, “hibernation mode” ensures that the SDK only collects this data when the device is in motion, such as while the user drives along a road or runs on a trail. Because no data is collected when the phone is at rest (i.e., sitting on your nightstand or on your desk at work), the application is able to fully suspend. When an application is fully suspended, as opposed to running in the background, it is absolved from any battery or background time responsibility in the iOS battery report. In addition, while Mapbox location services are hibernating in an app in the background, no telemetry is posted back to Mapbox so it truly has zero cost.
When you start moving again – for example, when you leave the office at the end of the day – the SDK wakes up to provide data to systems that monitor traffic conditions and look for road updates. The SDK uses the significant change location service to hold an iOS background task assertion, allowing it to wake up again and resume tracking once the device is in motion. We’ve found this to be the only way on iOS to allow the host application to completely let go of location services and suspend but also maintain the background task assertion. In addition to the significant change location service, we use the region monitoring API to trigger timely notifications when the device leaves a resting state.
All of this comes into play when an application is configured to run in background mode and the user grants the application always
permission (and permission for Mapbox Telemetry). The Mapbox iOS SDK always requests the least aggressive accuracy setting possible so that it will never be responsible for aggressively running the location radios. Only the host application or other applications on the device will drive the location services settings.
Hibernation mode leads to significant reductions in background system resource usage compared to an unoptimized strategy that only attempts to adjust location accuracy. The image below shows a 10-hour test of an unoptimized strategy (top), compared to the optimized strategy used in version 3.2.0 of the iOS SDK (bottom). Colored tick marks indicate location data collection and posting. Spaces between the marks in the optimized case represent times when the Mapbox-powered application fully suspends because the device is not in motion.
We added hibernation in the most recent release of the Mapbox iOS SDK, version 3.2.0. We will continue to improve and optimize our telemetry implementation in future releases. The best way to see how Mapbox Telemetry affects your application is to compile your app with it and run tests (on clean devices) against a baseline while measuring the proportional battery drain in the iOS battery report and absolute battery drain in the status bar.
Here’s to a long battery life, anonymized, aggregated, and protected data, and all the OpenStreetMap improvements and fresh satellite imagery this data makes possible!