PermissionsDispatcher icon indicating copy to clipboard operation
PermissionsDispatcher copied to clipboard

Android 11 runtime permission authorization popup does not pop up

Open xie438305665 opened this issue 4 years ago • 16 comments

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

xie438305665 avatar Feb 08 '21 09:02 xie438305665

Sorry we were focusing on maven central migration, would you mind elaborate on the issue?

hotchemi avatar Feb 19 '21 03:02 hotchemi

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.

misbahazmi avatar Feb 26 '21 13:02 misbahazmi

@misbahazmi are you using ktx or a normal one?

hotchemi avatar Feb 27 '21 04:02 hotchemi

trying to repro the issue with sample and ktx-sample but haven't been able to 🤔

hotchemi avatar Feb 27 '21 06:02 hotchemi

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

misbahazmi avatar Mar 04 '21 15:03 misbahazmi

any update here?

hotchemi avatar Mar 25 '21 15:03 hotchemi

~I'm having the same issue. The location request does not appear on screen.~

7RST1 avatar Mar 28 '21 17:03 7RST1

Can anyone give us an example(wondering this is not the library-specific issue)? 👀

hotchemi avatar Mar 29 '21 10:03 hotchemi

@hotchemi not really sure whether others stuck in the same issue, but I am facing the similiar issue when I request the Location permissions(ACCESS_BACKGROUND_LOCATION).(I'm using ktx library.)

ininmm avatar Mar 30 '21 06:03 ininmm

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()

ininmm avatar Mar 30 '21 07:03 ininmm

Turns out the dialog for the permissions didn't show up because I never requested them. My stupid ass thought the constructLocationPermissionRequest automatically added the location permissions for me, which I see now that it don't. Strike me from "having this issue" list.

7RST1 avatar Mar 30 '21 11:03 7RST1

Is there any update or workaround for this? Blocks me to upgrade android version

bgervan avatar Aug 31 '21 18:08 bgervan

oh sorry didn't notice the update, let us check

hotchemi avatar Sep 01 '21 03:09 hotchemi

@hotchemi Is there any update or workaround?

tayyabejaz avatar Nov 02 '21 08:11 tayyabejaz

Now considering what to do here. The quick workaround should be https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/707#issuecomment-809973388 ?

hotchemi avatar Nov 02 '21 14:11 hotchemi

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.

hotchemi avatar Nov 03 '21 12:11 hotchemi