Skip to content
PermissionChecker (Stop the maintenance!) Please see https://github.com/Werb/Azure
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
permissionschecker
screenshot
.gitignore
LICENSE
README.md
README_ZH.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

PermissionsChecker

License Download

A Library help u to check permissions on Android M.

中文版

Screenshot

screenshot screenshot

screenshot screenshot

Dependency

Gradle

  compile 'com.werb.permissionschecker:permissionschecker:last-version'

Maven

  <dependency>
      <groupId>com.werb.permissionschecker</groupId>
      <artifactId>permissionschecker</artifactId>
      <version>last-version</version>
      <type>pom</type>
  </dependency>

Usage

  • First :initialize an array of permissions (and statement in AndroidManifest.xml)
  static final String[] PERMISSIONS = new String[]{
            Manifest.permission.CAMERA,
            Manifest.permission.READ_EXTERNAL_STORAGE
    };
  • Second :initialize PermissionsChecker
  permissionChecker = new PermissionChecker(this); // initialize,must need
  permissionChecker.setTitle(getString(R.string.check_info_title)); // info when user refuse the Permissions ask not must need
  permissionChecker.setMessage(getString(R.string.check_info_message)); // we have default value , just as screenshot
  • Third :check Permissions
  // check if lack Permissions
  if (permissionChecker.isLackPermissions(PERMISSIONS)) {
        permissionChecker.requestPermissions();
  } else {
        // do something u want
  }
  • Fourth :Permissions call back
  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
      switch (requestCode) {
          case PermissionChecker.PERMISSION_REQUEST_CODE:
              if (permissionChecker.hasAllPermissionsGranted(grantResults)) {
                  // do something u want
              } else {
                  // show dialog when refuse the Permissions
                  permissionChecker.showDialog();
              }
              break;
      }
  }

Bug

Part of the domestic mobile phone to modify the permissions settings, if any abnormal circumstances, please contact me with issue, thank you

Known bug

Here will collect some known issues, if there is a good suggest, please contact me with issue

  • when request android.permission.CALL_PHONE ,if u call number with “ intent.setAction(Intent.ACTION_CALL) ” ,Mi Phone will disregard the permission request instead execute their own permission settings

License

Apache2.0

You can’t perform that action at this time.