Android M Permissions : Confused on the usage of shouldShowRequestPermissionRationale() function

I was going through the official doc about the new Permissions model in Android M. It talks about the shouldShowRequestPermissionRationale() function which returns true if the app has requested this permission previously and the user denied the request. If the user turned down the permission request in the past and chose the Don’t ask again option, this method returns false.

But how can we differentiate between the following two cases?

Case 1: The app doesn’t have a permission and the user has not been asked for the permission before. In this case, shouldShowRequestPermissionRationale() will return false because this is the first time we’re asking the user.

Case 2: The user has denied the permission and selected “Don’t ask again”, in this case too shouldShowRequestPermissionRationale() will return false.

I would want to send the user to the App’s settings page in Case 2. How do i go about differentiating these two cases?

12 Answers
12

Leave a Comment