When would you use the ActivityCompat.shouldShowRequestPermissionRationale() function?

✅  The correct answer is:

  • when a user has previously denied the request for a given permission and selected “Don’t ask again,” but you need the permission for your app to function

Question:

When would you use the ActivityCompat.shouldShowRequestPermissionRationale() function?

Solution:

  • when a user first opens your app and you want to provide an explanation for the use of a given permission
  • when a user has previously denied the request for a given permission and selects “Tell me more”
  • when a user has previously denied the request for a given permission and you want to provide an explanation for its use
  • when a user has previously denied the request for a given permission and selected “Don’t ask again,” but you need the permission for your app to function