Popularity
1.2
Growing
Activity
5.1
-
14
3
4

Description

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

Programming language: Java
License: MIT License
Tags: Java     Permission     Android-library    
Latest version: v1.2.3

PermissionMadeEasy alternatives and similar packages

Based on the "More lists of libraries" category

Do you think we are missing an alternative of PermissionMadeEasy or a related project?

Add another 'More lists of libraries' Package

README

Android Arsenal Release

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.thesomeshkumar:permissionmadeeasy:1.2.3'
    }

How to use

Create a PermissionHelper object

permissionHelper = PermissionHelper.Builder()
        .with(this)
        .requestCode(REQUEST_CODE_MULTIPLE)
        .setPermissionResultCallback(this)
        .askFor(Permission.CALENDAR, Permission.CAMERA, Permission.CONTACTS,
                Permission.LOCATION, Permission.MICROPHONE, Permission.STORAGE,
                Permission.PHONE, Permission.SMS, Permission.SENSORS)
        .rationalMessage("Permissions are required for app to work properly")
        .build()

and when you want to ask for the permission just call

permissionHelper.requestPermissions()

Override onPermissionsGranted and onPermissionsDenied functions

Also override onRequestPermissionsResult and pass the arguments recieved to PermissionHelper class' onRequestPermissionsResult function.

@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