Android 11 introduces changes to how apps can request the background location permission and how users can grant it. The specific changes depend on the app's target SDK version, but all apps that run on Android 11 are affected.
Background location access
Android 11 further emphasizes user control over location
information by adding one-time
permissions and by removing the ability
for users to grant the
ACCESS_BACKGROUND_LOCATION permission from an in-app
prompt, as shown in Figure 1.
All apps that run on Android 11 are affected by this change. The way that your app is affected depends on your app's target SDK version:
- If your app targets Android 11, you can create a custom
UI to explain to users why your app needs the
- If your app targets a lower version, you must use the system-provided UI, which states that your app wants to access location information in the background, even when your app isn't being used.
Create a custom UI
If your app targets Android 11, you can show a custom UI that
allows you to more clearly explain to users why your app needs the
Follow the guidelines in this section to create a UI that users are more likely to understand.
Explain your app's background location requirement
ACCESS_BACKGROUND_LOCATION in your app, your app must first get a
foreground location permission—either
ACCESS_FINE_LOCATION. If you try to request
any other permission at the same time, the system throws an exception.
After your app has one of these permissions, show a UI to the user where you
offer features that need the
ACCESS_BACKGROUND_LOCATION permission. This UI
should include text that explains why your app's feature requires the
ACCESS_BACKGROUND_LOCATION permission and present the user with a choice:
Grant the permission. If the user selects this option, make a permission request for
ACCESS_BACKGROUND_LOCATION. The system directs the user to system settings to complete the process of granting this permission.
To help users find the option in settings that allows them to grant the
ACCESS_BACKGROUND_LOCATIONpermission, you can include the user-visible label of the settings option in your app's UI. The
getBackgroundPermissionOptionLabel()method provides a label that's localized to the user's device language preference.
Don't grant the permission. Users should continue to be able to use your app if they don't grant the permission. If the user selects this option, your app can gracefully continue, possibly by navigating users away from the feature that requires background location access.
Even after your app is granted the
ACCESS_BACKGROUND_LOCATION permission, keep
in mind that users can change your app's location access to Allow only while
using the app or Ask every time in system settings. They could also deny
location access completely.
Direct users to system settings if necessary
If the user agrees to grant the
ACCESS_BACKGROUND_LOCATION permission to your
app, your app should direct the user to the settings screen that's shown in
Figure 2. This screen includes the Allow all the time option, which
grants your app the
Limited redirects to system settings
After your app navigates users to its permissions page in system settings, users might choose a level of location access other than Allow all the time, such as Deny. Android 11 allows your app to send users to system settings from a UI at most 2 times. Therefore, it's critical that you clearly explain to users why your app's feature requires access to background location.
When your app reaches this limit, you can still invoke an intent that directs
users to your app's info page within system settings. From there, users can
navigate to your app's permissions page. To load the app info page, use the
Caution: The use of
is strongly discouraged, as it doesn't explain to users that
your app is requesting the permission.
Use the system-provided UI
If your app targets Android 10 (API level 29) or lower, you must show a
system-provided dialog, as shown in Figure 3, when you request the
This dialog includes the following:
- Instructions on how to go to your app's location permissions page in system settings to select Allow all the time.
Buttons that grant foreground location access, or a button that denies an upgrade to background location access.