Skip to content

zyc945/Grant2

Repository files navigation

Grant2

inspire by the project Grant

Gradle usage:

  1. add compile dependency

compile 'com.zyc945.grant:grant-permissions:0.4.0'

  1. add repository

repositories{ maven { url 'https://dl.bintray.com/mrz0/maven/' } }

Feature:

simplifying android permission request procedure.

API List:

  • request permission, under API 23, permission auto callback with granted.

    public static synchronized void requestPermissions(Context context, String[] permissions, PermissionsResultAction action)
  • request all permissions defined in the AndroidManifest.xml

    public static synchronized void requestAllManifestPermissionsIfNecessary(Activity activity, PermissionsResultAction action)
  • check has permission, return true: had permission

    public static synchronized boolean hasPermission(Context context, String permission)
  • check has permissions

    public static synchronized boolean hasAllPermissions(Context context, String[] permissions)

Example

request camera permission.

        PermissionManager.requestPermissions(context, new String[]{Manifest.permission.CAMERA}, new PermissionsResultAction() {
                          @Override
                          public void onGranted() {
                            //permission granted callback
                          }

                          @Override
                          public void onDenied() {
                            //permission denied callback
                          }
          })

About

Android Permissions request manager

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages