Skip to content

Most visited

Recently visited

navigation

Background Location Limits

In an effort to reduce power consumption, Android O Developer Preview limits how frequently background apps can retrieve the user's current location, regardless of your app's target SDK version.

This location retrieval behavior is particularly important to keep in mind if your app relies on real-time alerts or motion detection while running in the background.

Important: As a starting point, we're allowing background apps to receive location updates only a few times each hour. We're continuing to tune the location update interval throughout the Preview based on system impact and feedback from developers.

The system distinguishes between foreground and background apps. An app is considered to be in the foreground if any of the following is true:

If none of those conditions is true, the app is considered to be in the background.

Foreground app behavior is preserved

If an app is in the foreground on a device running Android O, the location update behavior is the same as on Android 7.1.1 (API level 25) and lower.

Warning: If your app retrieves near real-time location updates over a long period of time, the device's battery life becomes significantly shorter.

Tuning your app's location behavior

Consider whether your app's use cases for running in the background cannot succeed at all if your app receives infrequent location updates. If this is the case, you can retrieve location updates more frequently by performing one of the following actions:

Note: If your app needs access to location history that contains time-frequent updates, use the batched version of the Fused Location Provider API elements, such as the FusedLocationProviderApi interface. When your app is running in the background, this API receives the user's location more frequently than the non-batched API. Keep in mind, however, that your app still receives updates in batches only a few times each hour.

Affected APIs

The changes to location retrieval behavior in background apps affect the following APIs:

Fused Location Provider (FLP)
  • If your app is running in the background, the location system service computes a new location for your app only a few times each hour, according to the interval defined in the Android O behavior change. This is the case even when your app is requesting more frequent location updates.
  • If your app is running in the foreground, there is no change in location sampling rates compared to Android 7.1.1 (API level 25).
Geofencing
  • Background apps can receive geofencing transition events more frequently than updates from the Fused Location Provider.
  • The average responsiveness for a geofencing event is every couple of minutes or so.
GNSS Measurements and GNSS Navigation Messages
Location Manager
  • Location updates are provided to background apps only a few times each hour, according to the interval defined in the Android O behavior change.

    Note: If your app is running on a device with Google Play services installed, it is highly recommended that you use the Fused Location Provider (FLP) instead.

Wi-Fi Manager
The startScan() method performs a full scan for background apps only a few times each hour. If a background app calls the method again soon afterward, the WifiManager class provides cached results from the previous scan.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.