Location updates in Android 11

To further protect user privacy, Android 11 adds one-time location access and changes how users grant background location access. These updates affect all apps that run on Android 11 and higher.

One-time access

Figure 1. System dialog for the foreground location permission includes an option called Only this time.

On Android 11 and higher, whenever your app requests access to foreground location, the system permissions dialog includes an option called Only this time, as shown in figure 1. This option give users more control over when an app can access location information.

Learn more about how the system handles one-time permissions.

Background location access

Android 11 changes how a feature in your app can gain access to background location. This section describes each of these changes.

If a feature in your app accesses location from the background, verify that such access is necessary. Consider getting the information that the feature needs in other ways, as described on the page about how to access location in the background.

Request background location separately

As described in the guide on how to request location access at runtime, you should perform incremental location requests. If your app targets Android 11 or higher, the system enforces this best practice. If you request a foreground location permission and the background location permission at the same time, the system ignores the request and doesn't grant your app either permission.

Permission dialog changes

Change details


Change ID: 147316723

How to toggle

As you test your app's compatibility with Android 11, you can toggle this change on or off using the following ADB commands:

adb shell am compat enable (147316723|BACKGROUND_RATIONALE_CHANGE_ID) PACKAGE_NAME
adb shell am compat disable (147316723|BACKGROUND_RATIONALE_CHANGE_ID) PACKAGE_NAME

For more information about the compatibility framework and toggling changes, see Test and debug platform behavior changes in your app.

When a feature in your app requests background location on a device that runs Android 11 or higher, the system dialog doesn't include a button to enable background location access. In order to enable background location access, users must set the Allow all the time option for your app's location permission on a settings page, as described in the guide on how to Request background location.

Additional resources

For more information about accessing background location, view the following materials: