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).
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Updated dependencies. Nov 4, 2017
src
.gitignore
.travis.yml Updated travis configuration. Nov 4, 2017
ISSUE_TEMPLATE.md
LICENSE Added email in license Sep 3, 2016
README.md Updated README.md with version name. Mar 29, 2018
build.gradle
gradlew
gradlew.bat
proguard-rules.pro

README.md

android-permissions Download Build Status

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).

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() would be called directly.
  • In case permissions are not yet provided, user would be asked for permissions (a dialog in case app is in foreground, a notification in case it's in background)
  • If user taps on Deny for any of the permissions asked by the app, PermissionRequestListener#onPermissionDenied() would be called.
  • If user taps on Allow for all the permissions asked by the app, PermissionRequestListener#onPermissionGranted() would be called.

Example:

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

                @Override
                public void onPermissionDenied() {
                    Toast.makeText(context, "Permissions Denied", Toast.LENGTH_SHORT).show();
                }
            });

Including into project

Gradle: implementation 'com.intentfilter:android-permissions:0.1.7'

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.intentfilter:android-permissions:0.1.7'
}