nativescript-community / perms

An unified permissions API for NativeScript on iOS and Android.
https://nativescript-community.github.io/perms/
Apache License 2.0
12 stars 9 forks source link

export `shouldShowRequestPermissionRationale` for Android 13 #20

Open sublime392 opened 1 year ago

sublime392 commented 1 year ago

This simply exports the function so that it can be used directly in client apps. Nothing was changed with the manner in which shouldShowRequestPermissionRationale is currently being used in the plugin. However, that usage does not seem to really match with the Android docs. It seems that when shouldShowRequestPermissionRationale returns true, the permission check returns GRANT_RESULTS.DENIED. This does not make it possible to distinguish between a truly denied permission and one that simply needs to show a rationale before requesting the permission.

As per Android docs*, the flow should be:

  1. check for permission
  2. check for shouldShowRequestPermissionRationale
  3. request permission (after showing rationale if indicated by step 2)