Tristate location permissions in Android 10 give users more control over how apps access their device locations.
In Android 9 and lower, users made persistent choices when granting location access to apps. They could either Deny or Allow, the latter of which gave apps access all the time (foreground and background). Tristate location permissions in Android 10 give users three options for allowing an app access to a device’s location. Users are prompted to grant or deny the permission level when an app requests it.
A user normally sees the three choices presented in Figure 1. However, there are use cases where only two of these options are required, and in such cases only those two are shown.
These are the three options:
- Allow all the time: the device’s location is known to the app even when the app is not in use (running in the background). This is equivalent to allowing permission in Android 9 and lower.
- Allow only while the app is in use: (foreground only) the device’s location is only visible to the app when it’s actively running.
- Deny: the device’s location is never visible to the app. This is the same as denying permission in Android 9 and lower.
Users are prompted to grant location access permission when apps request the permission.
Once a user grants Allow only while the app is in use access permission, an app can request an incremental increase in access to Allow all the time. The user sees a request dialog (shown in Figure 2). If the user selects Keep while-in-use access, when the app accesses device location on next use, the dialog provides the option to Keep and don't ask again.
The dialog appears under these conditions for apps targeting Android 10:
- After at least 24 hours of granting the permission.
- Only if the app is receiving locations in the background.
- When the screen is on, and the user is not utilizing another app.
The tristate location permissions feature affects any app that needs device location access while running in the background, and is required in Android 10.
You may change your code but you may not alter or customize permission-related behavior in the framework.
Tristate location permissions are applied to apps in Android 10 irrespective of an app’s target SDK.
For information on implementing your app's use cases (on upgrades), refer to the Design for device upgrade scenarios section in the developer documentation.
To see how to enable access for different use cases (such as requiring background location access for apps like Google Maps or Google Play services), view these topics on the App access to device location page:
In-app location access
Users can change your app’s access permissions to either Deny or Allow only while using the app if they choose. For in-app location access permission, and for all first-party and third-party apps, provide the levels of user control given in the following table.
|Permission type app needs to request
|User options to provide
|App requests foreground permissions only
|Allow only while using the app
|App requests permission always (foreground and background)
|Allow all the time
Allow only while using the app
|All apps with location access requests
|Allow only while using the app
These permissions apply to all location requests. Apps with Allow only while using the app permissions aren’t allowed background Wi-Fi or cell scans.
On Android 11 or lower, apps with Allow
only while using the app permissions aren't allowed background
Bluetooth scans. From Android 12, apps with
Allow only while using the app permissions can gain Bluetooth
scan results by setting the value of the
android:usesPermissionFlags attribute to
neverForLocation. For more details, see
App doesn't derive physical location.
On an OS upgrade to Android 10, app location permissions translate according to the following:
- On becomes Allow only while in Use.
- Off remains off (Deny).
- Pre-granted location access becomes the Allow only while in use pre-grant.