Credits for the answer to @Stephen Ruda

I have run into the exact same problem. I agree that this is an issue for any developer who needs background location permission. I would like to add additional notes for other readers:

(1) On API 30+ you will first need basic location permissions before asking for background location permission - otherwise, it won't go to the permission screen at all.

(2) When you ask for background location permission and it sends them to the permission request screen, it will only 'lock' the user out if they ONLY hit the back button. If they tap any of the options and then back the request will work again.

Answer from Victor Laerte on Stack Overflow
🌐
Medium
mohitsingh2002.medium.com › background-location-permission-in-android-11-and-above-1ab7399ec861
Background Location Permission in Android 11 and above | by Mohit Singh | Medium
June 23, 2021 - If you ask for ACCESS_FINE_LOCATION and ACCESS_BACKGROUND_LOCATION at once then permission dialog will not shown. First ask for fine location and if user accepts then ask for background location. In Android Version lower than 11, ACCESS_BACKGROUND_LOCATION shows a dialog like this:
🌐
Android Developers
developer.android.com › about › versions › 11 › privacy › location
Location updates in Android 11 | Android Developers
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.
Discussions

Android 11 users can’t grant background location permission? - Stack Overflow
In order to enable background location ... location permission on a settings page, as described in the guide on how to Request background location. https://developer.android.com/about/versions/11/privacy/location#change-details · The user-visible label of the settings option that grants background location (for example, Allow all ... More on stackoverflow.com
🌐 stackoverflow.com
API 30 Android 11: Requesting background location permission
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. More on github.com
🌐 github.com
0
June 16, 2021
Android 11 background location permission "Allow only while using the app" does not grant permission - Stack Overflow
As the title says, I'm currently in the process of updating my app to SDK 30 and having trouble with the ACCESS_BACKGROUND_LOCATION permission. Upon requesting the permission, the user is taken to ... More on stackoverflow.com
🌐 stackoverflow.com
java - Request Background location permission settings tab in android 11 - Stack Overflow
in android 11 (API 30) you can't request the permission ACCESS_BACKGROUND_LOCATION directly from the requestPermissions() method.. and instead, you need to enable it from the settings. On the Andr... More on stackoverflow.com
🌐 stackoverflow.com
September 11, 2021
🌐
Medium
medium.com › @ty2 › understanding-permissions-for-background-location-on-android-11-and-below-bc3ad9be320a
Understanding permissions for background location on Android 11 and below | by Abhi | Medium
August 27, 2024 - If user selects “allow all the time”, then the app will be able to access location in the background. ... When requesting location permission on Android 11, it will show 3 options with an additional message.
🌐
Google Support
support.google.com › googleplay › android-developer › answer › 9799150
Understanding location in the background permissions - Play Console Help
Minimum scope: Apps should request the minimum scope necessary (for example, using foreground instead of background device location permissions, using the location button for one-time or transactional location requests) to provide the feature or service that requires location. And users should reasonably expect that an app’s feature or service needs the level of location requested. For details and guidance on accessing foreground device location - including requirements for implementing the location button (apps targeting Android 17 or higher), please refer to the Minimum Scope: Foreground Location Access and the Location Button article.
Top answer
1 of 3
22

Credits for the answer to @Stephen Ruda

I have run into the exact same problem. I agree that this is an issue for any developer who needs background location permission. I would like to add additional notes for other readers:

(1) On API 30+ you will first need basic location permissions before asking for background location permission - otherwise, it won't go to the permission screen at all.

(2) When you ask for background location permission and it sends them to the permission request screen, it will only 'lock' the user out if they ONLY hit the back button. If they tap any of the options and then back the request will work again.

2 of 3
0

you cannot request foreground and background permission same time and cannot request background location permission without foreground permission granted. Therefore first you have to request foreground permission and then 'onRequestPermissionsResult' you can request background permission

First in onCreate

 if (ActivityCompat.checkSelfPermission(
            this,
            Manifest.permission.ACCESS_COARSE_LOCATION
    ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(
            this,
            Manifest.permission.ACCESS_FINE_LOCATION
    ) != PackageManager.PERMISSION_GRANTED
    ) {

        ActivityCompat.requestPermissions(
                this,
                new String[]{
                        Manifest.permission.ACCESS_COARSE_LOCATION,
                        Manifest.permission.ACCESS_FINE_LOCATION
                },
                1
        );


   @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
        ) {
            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED
            ) {
                ActivityCompat.requestPermissions(
                        this,
                        new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
                        1
                );
            }
        }
    }
}
🌐
Thestreamliners
thestreamliners.in › blog › background-location-permission-in-android-11-and-above
Background Location Permission in Android 11 and above
If you ask for ACCESS_FINE_LOCATION and ACCESS_BACKGROUND_LOCATION at once then permission dialog will not shown. First ask for fine location and if user accepts then ask for background location. In Android Version lower than 11, ACCESS_BACKGROUND_LOCATION shows a dialog like this:
🌐
Android Developers
developer.android.com › core areas › sensors and location › request background location
Request background location | Sensors and location | Android Developers
When a feature in your app requests background location on a device that runs Android 10 (API level 29), the system permissions dialog includes an option named Allow all the time. If the user selects this option, the feature in your app gains background location access. On Android 11 (API level 30) and higher, however, the system dialog doesn't include the Allow all the time option.
Find elsewhere
🌐
Mobikul
mobikul.com › home › user location in android 11
User Location in Android 11 - Mobikul - Android Location
October 11, 2021 - Before Android 9, there was no separate location permission for the Foreground and background apps therefore they were using the same resources due to this some of the apps were exploiting the location data of the users. On Android 11 and higher, whenever your app requests access to the foreground location, the system permissions dialog includes an option called Only this time.
🌐
Yudiz Solutions Ltd.
blog.yudiz.com › background-location-usage-in-android-11
How To Use Background Location in Android Version 11
December 6, 2024 - Android 10 (Q): New ACCESS_BACKGROUND_LOCATION permission for the apps using location in background, prior to this version there was a single permission for background and foreground state of application. Android 11 (R): ACCESS_BACKGROUND_LOCATION is separated from other location permissions, the user has to grant background permission explicitly from the application’s setting page.
🌐
Medium
medium.com › swlh › request-location-permission-correctly-in-android-11-61afe95a11ad
Request Location Permission Correctly in Android 11. | by Lam Pham | The Startup | Medium
April 26, 2025 - From Android 8 (≥8): background apps can only retrieve user’s location a few times each hour. Prior to Android 10(<10), location permission was a single resource: apps only required permission once to use everywhere (foreground and background) and every time.
🌐
GitHub
github.com › Karumi › Dexter › issues › 281
API 30 Android 11: Requesting background location permission · Issue #281 · Karumi/Dexter
June 16, 2021 - private fun requestAccessFineLocation() { Dexter.withContext(this) .withPermissions(createPermissionList1()) .withListener(object : MultiplePermissionsListener { override fun onPermissionsChecked(report: MultiplePermissionsReport) { Log.i("myApp", "onPermissionsChecked1 = " + report.areAllPermissionsGranted()) } override fun onPermissionRationaleShouldBeShown( permissions: MutableList<PermissionRequest>, token: PermissionToken ) { Log.i("myApp", "onPermissionRationaleShouldBeShown1") token.continuePermissionRequest() } }).check() } private fun createPermissionList1(): MutableList<String> { val permissionList = mutableListOf( Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION ) return permissionList }
Author   Karumi
🌐
Android Developers
developer.android.com › core areas › sensors and location › request location permissions
Request location permissions | Sensors and location | Android Developers
If a feature in your app absolutely requires access to precise location using the ACCESS_FINE_LOCATION permission, you can ask the user to allow your app to access precise location. On Android 10 (API level 29) and higher, when a feature in your app accesses device location in the background for the first time after the user grants background location access, the system schedules a notification to send to the user. This notification reminds the user that they've allowed your app to access device location all the time. An example notification appears in figure 8.
🌐
Androidsis
en.androidsis.com › android versions › android 11 › how to give an app permission to access the location in the background in android 11
How to give an app permission to access the location in the background in Android 11
July 4, 2020 - To do this we have to go to the app permission settings - Location and activate «Always allow». Google is giving developers a bit more time get to tailor your application requirements for background location access.
🌐
Berkeleycollege
engage.berkeleycollege.edu › default › android_background_location › index
Android Background Location
If given the option, the "Always" selection enables location services to be used while the app is closed or not in use; "Allow only while using the app" will restrict these permissions to only allow location information to be accessed while the app is open and being used. You can see an example of these permissions on Android 11 in the screenshot below.
🌐
GitHub
github.com › woosmap › woosmap-geofencing-android-sdk › blob › master › doc › EnablingLocation.md
geofencing-android-sdk/doc/EnablingLocation.md at master · Woosmap/geofencing-android-sdk
June 16, 2021 - When a feature in your app requests background location on a device that runs Android 10 (API level 29), the system permissions dialog includes an option named Allow all the time. If the user selects this option, the feature in your app gains background location access. On Android 11 (API level 30) and higher, however, the system dialog doesn't include the Allow all the time option.
Author   Woosmap
🌐
9to5Google
9to5google.com › home › android 11 requires visiting settings to grant apps background location access
Android 11 requires visiting Settings to grant apps background location access
June 29, 2020 - Apps — location sharing, emergency/safety — that need the background permission will have to direct users to the full Settings app. An application will first need to ask for foreground location, and can then direct users via a prompt to open system preferences. This makes the entire process a “more deliberate action.” · Building off the ability to limit location to “While app is in use,” Android 11 adds one-time permissions for microphone, camera, and location.
🌐
Google
android-developers.googleblog.com › 2020 › 02 › safer-location-access.html
Android Developers Blog: Safer and More Transparent Access to User Location
Now in Android 11, we’re giving ... like location. When users select this option, apps can only access the data until the user moves away from the app, and they must then request permission again for the next access. Please visit the Android 11 developer preview to learn more. Preventing unnecessary access to background ...
🌐
Medium
medium.com › google-developer-experts › exploring-the-android-11-developer-preview-permission-changes-61b18fb658
Exploring the Android 11 Developer Preview: Permission Changes | by Joe Birch | Google Developer Experts | Medium
February 24, 2020 - When targeting Android 11, applications will no longer have the ability to request access to location data all of the time from within your application — this option has been removed from the in-app permissions dialog. If an application wants permission to access the users location all the time when in the background, the permission will need to be granted from within the system settings screen for your application.