Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 671 forks source link

Add force permission option #156

Closed bastienpaulfr closed 7 years ago

bastienpaulfr commented 7 years ago

Hi

I have added a "force" option to ask for permission even if the system tells that the permission is granted.

I have the need of this option because I am developing a system app. On my particular device, Android is telling me that I got the permission whereas I still need to ask for explicitly. I am not sure that this problem occurs on all devices.

I have already made a request of this change here : https://github.com/Karumi/Dexter/pull/147

I have reworked it to separate several changes I have made.

Nevertheless, I would need some help to write some test about it. I would appreciate some hint for me to write like you've done before to test your library. We might want to test the case where the system is telling that permission is granted and still we are asking for permission. Or a more abstract test where we are asking for permission in any cases.

Thank you very much for spending some times in reviewing my code.

Serchinastico commented 7 years ago

I'm with @fjfdeztoro in this one, I don't see the value on forcing the permission checks for the general user. What's more, I think it'd bring more problems than solutions and that's why won't support it.

I'd suggest doing a fork for this specific situation as we'll like to keep the API as simple as possible.

Thank you for your help, time and work.