Simplify Permission

Additional

Language
Java
Version
v1 (Nov 9, 2016)
Created
Aug 16, 2016
Updated
Nov 10, 2016 (Retired)
Owner
Anshul Agarwal (anshulagarwal06)
Contributor
Anshul Agarwal (anshulagarwal06)
1
Activity
Badge
Generate
Download
Source code

Simplify Permission

Simplify Android permission with in-build message Dialogs.

Feature

  • InBuild Rational Dialog with custom message
  • InBuild SettingScreen Dialog with custom Message.
  • Callback for permission state :
    • Permission granted
    • Permission removed
    • Permission access removed.

How to use

  • Extent Activity to MarshmallowSupportActivity
    public class MainActivity extends MarshmallowSupportActivity
  • Create PermissionBuilder.
            String[] CAMERA_PERMISSIONS = {Manifest.permission.CAMERA};

            PermissionBuilder permissionBuilder =
            new PermissionBuilder(CAMERA_PERMISSIONS,REQUEST_CARMERA, mPermissionCallback);
            .enableDefaultRationalDialog("Ration dialog title", "Ration Dialog message")
            .enableDefaultSettingDialog("Setting Dialog title", "Setting dialog message");

  • Call requestAppPermissions(permissionBuilder.build())
            requestAppPermissions(permissionBuilder.build());
  • Handle Permission callBacks
    private mPermissionCallback = new PermissionCallback(){

        @Override
        public void onPermissionGranted(int requestCode) {

        }

        @Override
        public void onPermissionDenied(int requestCode) {

        }

        @Override
        public void onPermissionAccessRemoved(int requestCode) {

        }
    }

Download

Include jitpack.io inside of root project build.gradle:

allprojects {
  repositories {
   ...
   maven { url "https://jitpack.io" }
  }
 }

After that you can easily include the library in your app build.gradle:

dependencies {
         compile 'com.github.anshulagarwal06:Simplify-Permissions:v1'
 }

That's it. build your project.