9 Forces Undermining your Location-Based Mobile App
Mobile apps that require access to the location (GPS) and/or motion services on your device may more often than not fail to provide satisfactory results.
There's more than one single reason why apps fail to provide accurate user locations. Here's a rundown of all aspects that we know play a role in acquiring and processing the user's location on a mobile device.
1. Permissions
Both Android and iOS allow the user to switch off Location Services within the device settings. This can be done for all apps combined or individually for each app. There's nothing your mobile app can do to prevent this, though you should detect when location services are unavailable for your app and warn the user about the impacts of this change.
On Android, the user has more granular control over which hardware is used to get a location "fix": GPS only, WiFi only, or both GPS and WiFi. This. of course, affects the availability, frequency and accuracy of location updates to your app.
2. Power Saving
Both Android and iOS include a Low Power Mode capability in the device settings. This mode essentially throttles down any "battery hungry" hardware such as GPS and limits or entirely stops location updates to your app.
Some Android devices include a Battery Assistant, which may auto-suspend your app while it's running in the background in order to conserve device battery.
On top of that, Android includes a capability to Schedule power on & off, which is accessible directly via the devices Settings or via the Battery Settings. This setting allows the user to schedule automatic power-off of the device.
3. Background App Refresh
This "feature" exists on iOS and is documented as:
Background App Refresh lets your app run periodically in the background so that it can update its content. Apps that update their content frequently, such as news apps or social media apps, can use this feature to ensure that their content is always up to date.
Background App Refresh is seemingly unrelated to location services, at least not based on recent Apple documentation. However, in my experience, disabling Background App Refresh prevents the delivery of significant location updates while the app is in the background. This is also backed by (less recent) Apple documentation:
Note: When a user disables the Background App Refresh setting either globally or for your individual app, the significant-change location service doesn’t relaunch your app. Further, while Background App Refresh is off an app doesn’t receive significant-change or region monitoring events even when it's in the foreground.
4. Background Execution
Fact: iOS prevents apps from running in the background. When an app moves to the background it is suspended and effectively stops running. Apps that need to continue tracking your location in the background must request permission to run in the background, in which case the system allows them to continue running for a limited time (usually 3 minutes).
Requesting additional time is possible, but this requires using a dedicated API for performing a long running task.
Some variants of Android employ a similar system behavior, where apps are "cleaned up" by default when they are moved to the background. In such Android systems, you can exclude specific apps from being cleaned up by adding them to the "protected apps" under Battery > App Protection. There's another setting that may be available on some Android phones called Lock-screen Cleanup, which terminates background apps as soon as the screen is locked.
5. Airplane mode
GPS hardware is switched off when the device is in airplane mode. Location services are then limited to WiFi, provided that WiFi is enabled on the device and sufficient hotspots are available around the user in order to guestimate their location. This is often referred to as "assisted GPS," which is grossly inaccurate (±60-250 meters, depending on hotspot availability).
6. Device & Platform
We've seen some plain crazy results with some low-end Android devices which provided completely inaccurate and random location readings. We've also experienced significant drift of location on iPhoneX running iOS 11 (and reported this to Apple).
The bottom line is, as an app developer, you rely on 3rd party hardware and a software stack which may sometimes fail.
7. WiFi
The availability of WiFi (or lack thereof) may greatly affect the accuracy of locations reported to your app. WiFi plays a significant role in geofencing and low-power (low accuracy) location updates which your app may depend on. In areas with dense hotspot distribution, WiFi triangualtion works great and geofencing is quite accurate. In rural areas where WiFi density is low, you may experience very low geofencing accuracy, as assisted GPS falls back on cell-tower triangulation.
8. Weather
GPS is based on satellite signal, which can be affected by atmospheric conditions like rain or snow. Although these conditions can weaken the GPS signal, they generally do not affect GPS reception. Having said that, different mobile devices may behave differently in different temperatures. It is possible that when battery operated GPS devices are cold due to weather conditions, they will emit less power which can result in signal degradation.
9. Position
The accuracy of the location determined by the device's hardware relies heavily on signal strength. GPS, WiFi, and Cellular Radio are all electromagnetic signals transmitted through the air. As such, these signal attentuate when passing through physical barriers such as metal, thick concrete, stone walls, etc.
When the user's position is underground, inside an indoor space with no windows or in a tunnel, the availability of signals depends on infrastructure such as repeaters and amplifiers.