PermissionX
申请权限也能使用协程?Why not?
使用方法
权限申请只需一行代码
launch {
try {
val result = request(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
if (result.isGranted) {
//Now we have storage permission.
}else {
if (result.shouldShowRational) {
//Show permission rational
}
if (result.alwaysDenied) {
//User always denied our permission
}
}
} catch (t: Throwable) {
Log.w("TAG", t)
}
}