PermissionsDispatcher: Android 11 runtime permission authorization popup does not pop up

FAQs


Overview

  • Describe the issue briefly

Expected

  • What is the expected behavior?

Actual

  • What is the actual behavior?

Environment

  • Which library version are you using?
  • On which devices do you observe the issue?
  • Note any other information that might be useful

Reproducible steps

  • While it’s not required, it’d be perfect to add a link to a sample project where you encounter the issue

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@hotchemi - I am using normal one. I will try to reproduce the same. Thanks

Right now I’m thinking of creating one more pattern of PermissionRequestFragment and request the background permission, or having a lint to prevent the mistake from happening.

Ok I think I’ve repro my issue in the ktx-sample project, just change COMPILE_SDK_VERSION and TARGET_SDK_VERSION to 30 then request all of the Location permissions, and I think this is because of the latest limit for Location background permission.

According to the doc, the system enforces us to request ACCESS_BACKGROUND_LOCATION after granted the foreground Locations, otherwise the request dialog will not appear.

I’ve granted the ACCESS_BACKGROUND_LOCATION successfully by 2-step requests:

    private lateinit var locationRequest: PermissionsRequester
    private lateinit var backgroundLocationRequest: PermissionsRequester

    override fun onAttach(context: Context?) {
        locationRequest = constructLocationPermissionRequest(
                LocationPermission.COARSE, LocationPermission.FINE,
                onShowRationale = ::onLocationShowRationale,
                onPermissionDenied = ::onLocationDenied,
                onNeverAskAgain = ::onLocationNeverAskAgain
        ) {
            backgroundLocationRequest.launch()
        }
        backgroundLocationRequest = constructLocationPermissionRequest(
                LocationPermission.BACKGROUND,
                onShowRationale = ::onLocationShowRationale,
                onPermissionDenied = ::onLocationDenied,
                onNeverAskAgain = ::onLocationNeverAskAgain
        ) {
            Toast.makeText(requireActivity(), "Enable location!", Toast.LENGTH_SHORT).show()
        }
    }

    // locationRequest.launch()

I am also facing the same issue i.e. Android 11 runtime permission authorization popup not coming. We updated the to version 4.8.0 also.