v2.0.54 (Apr 10, 2020)
Aug 29, 2016
Oct 4, 2021
Nishkarsh (nishkarsh)
Nishkarsh (nishkarsh)
Thomas Zimmermann (zimmi)
Source code

Show card


An android library that makes it really easy to deal with dynamic permissions. Based on the context, library automatically decides whether to show a dialog (in case app is in foreground) or a notification (in case permission is required by a background service).

Important Note

The migration of artifacts to Maven Central is currently under progress. The newer builds would be published under group id io.github.nishkarsh.

To include into the project, please select a particular published version and follow the instructions provided for the dependency management tool used:

How does it work?

  • Get an instance of PermissionManager using PermissionManager#getInstance()
  • Invoke PermissionManager#checkPermissions(Collection<String> permissions, PermissionRequestListener listener)
  • If permissions are already granted by user, PermissionRequestListener#onPermissionGranted() is called directly.
  • In case permissions are not yet provided, user is asked for permissions (a dialog in case app is in foreground, a notification in case it's in background). Asking for permissions from a Service follows the same principle.
  • If user taps on Deny for any of the permissions asked by the app, PermissionRequestListener#onPermissionDenied(DeniedPermissions deniedPermissions) is called.
  • If user taps on Allow for all the permissions asked by the app, PermissionRequestListener#onPermissionGranted() is called. This behaviour is per set of permissions asked.
  • If Don't ask again is checked by the user in the permission dialog displayed, DeniedPermission#shouldShowRationale() returns false.


PermissionManager permissionManager = PermissionManager.getInstance(context);
permissionManager.checkPermissions(singleton(Manifest.permission.CAMERA), new PermissionManager.PermissionRequestListener() {
                public void onPermissionGranted() {
                    Toast.makeText(context, "Permissions Granted", Toast.LENGTH_SHORT).show();

                public void onPermissionDenied(DeniedPermissions deniedPermissions) {
                    String deniedPermissionsText = "Denied: " + Arrays.toString(deniedPermissions.toArray());
                    Toast.makeText(context, deniedPermissionsText, Toast.LENGTH_SHORT).show();
                    for (DeniedPermission deniedPermission : deniedPermissions) {
                        if(deniedPermission.shouldShowRationale()) {
                            // Display a rationale about why this permission is required

Suggestions for Usage

Permissions must be separated per functionality. After getting the instance of PermissionManager, the call to PermissionManager#checkPermissions(Collection<String> permissions, PermissionRequestListener listener) must be made for each set of permissions that are required for specific features.

For example, if you need to access location for scanning beacons and need to access contacts and storage to perform another operation, ask for location permission and other permissions separately. This would help you focus only on a particular functionality at a time.

Including into project

Gradle: implementation 'io.github.nishkarsh:android-permissions:2.0.54'

Add android-permissions as dependency inside app module build.gradle under dependencies block. Your app level build.gradle should look like:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'io.github.nishkarsh:android-permissions:2.0.54'