PermissionX
申請權(quán)限也能使用協(xié)程?Why not?
使用方法
權(quán)限申請只需一行代碼
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)
}
}