/ Tool

Helps You to Grant Runtime Permission on Android Marshmallow and Above

Helps You to Grant Runtime Permission on Android Marshmallow and Above

Sheriff

Helps You to Grant Runtime Permission on Android Marshmallow and Above.

Library in Use

Here is a screencast of the sample App

Sheriff

How to build

Gradle

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

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

Add the dependency

dependencies {
	  implementation 'com.github.IamIsPra:Sheriff:$sheriffVersion'
	}

The Latest Sheriff Version is :

Maven

<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>

Add the dependency

<dependency>
	<groupId>com.github.IamIsPra</groupId>
	<artifactId>Sheriff</artifactId>
	<version>1.0.0</version>
</dependency>

How to use

Create a Sheriff object

       Sheriff sheriffPermission = Sheriff.Builder()
                .with(this)
                .requestCode(REQUEST_SINGLE_PERMISSION)
                .setPermissionResultCallback(this)
                .askFor(SheriffPermission.CONTACTS)
                .build();

and when you want to ask for the permission just call

sheriffPermission.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);
        sheriffPermission.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }

GitHub