anoreg / DynamicPermission

A lib simplify for request permission above Android M

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage:

 PermissionUtil.requestStorage(this, new PermissionDialog.IPermissionListener() {
        @Override
        public void onGrant(boolean isGranted) {
            if (isGranted) {
                // TODO: 18-12-5 do your things
            }
        }
    });

There are many methods, like requestLocation, requestCamera, and also you can pass an permission array to the PermissionUtil.

All you need to do is add PermissionUtil.request* to your code and waiting for the callback

If the user deny the permission, this util will again request the permission. If user check the always deny button, this util will lead the user to app detail setting to manually check the permission button

Gradle:

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

dependencies {
        implementation 'com.github.anoreg:DynamicPermission:v1.0'
}

Maven:

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

<dependency>
    <groupId>com.github.anoreg</groupId>
    <artifactId>DynamicPermission</artifactId>
    <version>v1.0</version>
</dependency>

About

A lib simplify for request permission above Android M


Languages

Language:Java 100.0%