https://github.com/xfhy/permissionx
权限申请
https://github.com/xfhy/permissionx
Last synced: 3 months ago
JSON representation
权限申请
- Host: GitHub
- URL: https://github.com/xfhy/permissionx
- Owner: xfhy
- License: apache-2.0
- Created: 2020-05-04T10:18:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T07:11:21.000Z (about 5 years ago)
- Last Synced: 2025-01-16T01:17:07.897Z (5 months ago)
- Language: Kotlin
- Size: 136 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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()
}
}
```