PermissionMadeEasy

Additional

Language
Java
Version
1.1.1 (Nov 25, 2018)
Created
Dec 24, 2017
Updated
Nov 25, 2018
Owner
Somesh Gurjar (someshkumar049)
Contributor
Somesh Gurjar (someshkumar049)
1
Activity
Badge
Generate
Download
Source code

Commercial

PermissionMadeEasy

Android Library for Easily calling Runtime Permission on Android Marshmallow and above

How to build

Add Jitpack.io to your project level build.gradle file

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

Add the dependency

dependencies {
   implementation 'com.github.someshkumar049:permissionmadeeasy:1.1.1'
 }

How to use

Create a PermissionHelper object

 PermissionHelper permissionHelper = PermissionHelper.Builder()
                .with(this)
                .requestCode(REQUEST_CODE_MULTIPLE)
                .setPermissionResultCallback(this)
                .askFor(Permission.CALENDAR, Permission.CAMERA, Permission.CONTACTS)
                .rationalMessage("Permissions are required for app to work properly") //Optional
                .build();

and when you want to ask for the permission just call

permissionHelper.requestPermissions();

Override onPermissionsGranted and onPermissionsDenied methods

Also override

@Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        permissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }

Detailed full sample project is included. Check DemoActivity for full implemetation