From 962ec99c154968e45062b9ec924ce9fc7d4b9c78 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Wed, 30 May 2018 10:21:26 -0700 Subject: [PATCH] Add clarification (based on #212) Change-Id: Id60b0b3ed25d44f3e3da027427a4337dd6672e92 --- README.md | 6 ++++++ .../java/pub/devrel/easypermissions/EasyPermissions.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 06521f9..1b0ac99 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,12 @@ these permissions from the user and they must be changed in app settings. You ca method `EasyPermissions.somePermissionPermanentlyDenied(...)` to display a dialog to the user in this situation and direct them to the system setting screen for your app: +**Note**: Due to a limitation in the information provided by the Android +framework permissions API, the `somePermissionPermanentlyDenied` method only +works after the permission has been denied and your app has received +the `onPermissionsDenied` callback. Otherwise the library cannot distinguish +permanent denial from the "not yet denied" case. + ```java @Override public void onPermissionsDenied(int requestCode, List perms) { diff --git a/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java b/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java index bc54efc..b9885ab 100644 --- a/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java +++ b/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java @@ -291,6 +291,12 @@ public static void onRequestPermissionsResult(int requestCode, * Check if at least one permission in the list of denied permissions has been permanently * denied (user clicked "Never ask again"). * + * Note: Due to a limitation in the information provided by the Android + * framework permissions API, this method only works after the permission + * has been denied and your app has received the onPermissionsDenied callback. + * Otherwise the library cannot distinguish permanent denial from the + * "not yet denied" case. + * * @param host context requesting permissions. * @param deniedPermissions list of denied permissions, usually from {@link * PermissionCallbacks#onPermissionsDenied(int, List)}