PermissionX是一个可以简化权限申请的框架
PermissionX is a tool for simplify the permissions request in android
- Add it in your root
build.gradle
at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in the
build.gradle
of the Module
dependencies {
implementation 'com.github.djzhao627:PermissionX:1.0'
}
- do permissions request
PermissionX.request(
this,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_CONTACTS
) { allGranted, deniedList ->
if (allGranted) {
// continue to work...
} else {
Toast.makeText(this, "You Denied $deniedList", Toast.LENGTH_SHORT).show()
}
}