With Android 6.0 (API 23) users are able to grant app permissions during run time. That new feature made our developer lives a bit more difficult, but gave huge powers to our users. And do you remember that little check box which says ‘Never ask me again’?
Yep… this particular one! So, how can we know that this check box had ever been selected by the user? Actually, it’s not that difficult! There is a method called shouldShowRequestPermissionRationale . This method has a boolean return type. It returns:
- true – if the app has requested this permission previously and the user denied it without selecting the ‘Never ask me again’ checkbox
- false – if the permission was denied together with the checkbox being checked
So, if this method returns false , then we can be sure that the checkbox was selected and we can show a dialog to the user and navigate him / her to the phone settings where he / she can enable that permission.
Sadly, as of this date, the official Android documentation for this method does not represent the reality. Right now, this method accepts only the String parameter. The Activity parameter is currently missing.
Feel free to share, comment & give your opinion on the topic!
And only if you really REALLY liked the article, you can buy me a cup of coffee! Otherwise, don’t do it! Donate $1