Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
appsample
gradle/wrapper
library
.gitignore
CHANGELOG.md
LICENSE.txt
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

Android Permissions Checker

Android M was added to check Permission. but Permission check processing is so dirty.

This Project is to be simple, Checking permissions.

Install

repositories {
    jcenter()
}

compile 'com.nobrain.android.permissions:library:1.1.0'

How to use

  • To check permissions
AndroidPermissions.check(this)
    .permissions(Manifest.permission.CALL_PHONE)
    .hasPermissions(new Checker.Action0() {
        @Override
        public void call(String[] permissions) {
            // do something..
        }
    })
    .noPermissions(new Checker.Action1() {
        @Override
        public void call(String[] permissions) {
            // do something..
        }
    })
    .check();

  • To get Result
public void onRequestPermissionsResult(int requestCode, final String[] permissions, int[] grantResults) {
    AndroidPermissions.result(MainActivity.this)
        .addPermissions(REQUEST_CODE, Manifest.permission.CALL_PHONE)
        .putActions(REQUEST_CODE, new Result.Action0() {
            @Override
            public void call() {
                // do something..
            }
        }, new Result.Action1() {
            @Override
            public void call(String[] hasPermissions, String[] noPermissions) {
                // do something..
            }
        })
        .result(requestCode, permissions, grantResults);
}
You can’t perform that action at this time.