An open API service indexing awesome lists of open source software.

https://github.com/xfhy/permissionx

权限申请
https://github.com/xfhy/permissionx

Last synced: 3 months ago
JSON representation

权限申请

Awesome Lists containing this project

README

        

# PermissionX

PermissionX是一个用于简化Android运行时权限用法的开源库。

添加如下配置将PermissionX引入到你的项目当中:

```groovy
dependencies {
implementation 'com.permissionx.xfhy:permissionx:1.0.0'
}
```

然后就可以使用如下语法结构来申请运行时权限了:

```kotlin
PermissionX.request(this,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_CONTACTS) { allGranted, deniedList ->
if (allGranted) {
Toast.makeText(this, "All permissions are granted", Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(this, "You denied $deniedList", Toast.LENGTH_SHORT).show()
}
}
```