Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11 runtime permission authorization popup does not pop up #707

Open
xie438305665 opened this issue Feb 8, 2021 · 16 comments
Open

Comments

@xie438305665
Copy link

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
@hotchemi
Copy link
Member

hotchemi commented Feb 19, 2021

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

@misbahazmi
Copy link

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.

@hotchemi
Copy link
Member

@misbahazmi are you using ktx or a normal one?

@hotchemi
Copy link
Member

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

@misbahazmi
Copy link

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

@hotchemi
Copy link
Member

any update here?

@7RST1
Copy link

7RST1 commented Mar 28, 2021

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

@hotchemi
Copy link
Member

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

@ininmm
Copy link

ininmm commented Mar 30, 2021

@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
Copy link

ininmm commented Mar 30, 2021

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

@7RST1
Copy link

7RST1 commented Mar 30, 2021

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.

@bgervan
Copy link

bgervan commented Aug 31, 2021

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

@hotchemi
Copy link
Member

hotchemi commented Sep 1, 2021

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

@tayyabejaz
Copy link

@hotchemi Is there any update or workaround?

@hotchemi
Copy link
Member

hotchemi commented Nov 2, 2021

Now considering what to do here.
The quick workaround should be #707 (comment) ?

@hotchemi
Copy link
Member

hotchemi commented Nov 3, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants