Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Permission rational not showing on the first permission request #61

Closed
pkleczko opened this issue May 3, 2016 · 6 comments
Closed

Permission rational not showing on the first permission request #61

pkleczko opened this issue May 3, 2016 · 6 comments

Comments

@pkleczko
Copy link

pkleczko commented May 3, 2016

Expected behaviour

onPermissionRationaleShouldBeShown(List permissions, PermissionToken token) fires always when Dexter.checkPermissions is called

Actual behaviour

Cannot understand why this happens but when I firstly call Dexter.checkPermissions with two permissions: Manifest.permission.ACCESS_FINE_LOCATION and Manifest.permission.ACCESS_COARSE_LOCATION onPermissionRationaleShouldBeShown is not called but instead dialog with permission request shows. What is more there is no "Never ask again" checkbox:
screen1

When I deny and call method second time, onPermissionRationaleShouldBeShown is called and I show my alertDialog and then permission request dialog has "Never ask again" checkbox.
screen2

Steps to reproduce

Dexter.checkPermissions(new CustomPermissionListener(), Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);

Nexus 5, 6.0.1

Version of the library

com.karumi:dexter:2.2.2

@Serchinastico
Copy link
Contributor

Hi @pkleczko

First of all, thanks for reporting.

The behaviour you are describing is how actually Android permissions work, the first time you request any permission the system will simply show the dialog asking the user for her consent. If the user requests the same permission for the second time, the system will call the shouldShowRequestPermissionRationale callback to let you explain to your user why your app needs the requested feature.

I recommend you to read the official runtime permissions documentation, specially the section referring to the rationale: link

@pkleczko
Copy link
Author

pkleczko commented May 8, 2016

Yes, you're rigth. I was not aware it works like this. Thanks for reply.

@pkleczko pkleczko closed this as completed May 8, 2016
@Hoss3inf
Copy link

Hoss3inf commented Jun 9, 2019

Dear @Serchinastico
I was wondering if there is any way to let the user see the dialog the first time the app attempts to ask for the permission, as an explanation to the user why the app is asking for the permission?
thanks in advance.

@pedrovgs
Copy link
Contributor

@Hoss3inf you can always show any or contextual help dialog before using Dexter.

@Hoss3inf
Copy link

@pedrovgs I just thought I can do it within Dexter. thanks for your reply.

@pedrovgs
Copy link
Contributor

That's simple to implement and depends a lot on the user needs that we decided not to add that feature to the lib.

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

No branches or pull requests

4 participants