QuickPermissions / QuickPermissions-Kotlin

The most easiest way to handle Android Runtime Permissions in Kotlin
Apache License 2.0
317 stars 40 forks source link

Rationale dialog is hidden beneath permissions dialog when called from onResume #4

Closed frysztak closed 6 years ago

frysztak commented 6 years ago

I'm trying to integrate this library into my app and I can't get it to work properly.

After first permissions dialog appears and user selects "deny", rationale dialog should pop up -- explaining why this permission is needed, am I right? I can't get it to work, rationale dialog indeed appears, but it's behind permissions dialog, which keeps appearing over and over again. Is this intended?

frysztak commented 6 years ago

Update: It turns out my issue was caused by the fact that I was calling runWithPermission from onResume. Moving it to onCreate works, but is not desirable.

kirtan403 commented 6 years ago

Permission dialog is invoked by the system's package manager. So It will always appear on top of your app's all views. It is kind of start activity for result. So when you deny the permissions, the control returns to your activity and the dialog is shown. As you said it was behind the rational dialog, because when control returned to your activity, it calls onResume. And permission is not granted so it starts permission request flow. This is the intended behavior. If you try to do the same thing with the sdk's methods directly, you will see the same thing. Refer this SO question: https://stackoverflow.com/q/43680921/1820644

Closing this issue. If you get any trouble, feel free to comment here or create the new issue.