guolindev / PermissionX

An open source Android library that makes handling runtime permissions extremely easy.
Apache License 2.0
3.52k stars 406 forks source link

申请 MANAGE_EXTERNAL_STORAGE 时,没有跳转直接返回失败 #279

Open Tanuyoki opened 6 months ago

Tanuyoki commented 6 months ago

下面代码使用 MANAGE_EXTERNAL_STORAGE 并且不进行 showRequestReasonDialog 就能复现 这时不会跳转到设置页,直接返回 deniedList

    private fun request() {
        val permissions = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
            listOf(Manifest.permission.MANAGE_EXTERNAL_STORAGE)
        } else {
            listOf(
                Manifest.permission.READ_EXTERNAL_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE)
        }
        PermissionX.init(this)
            .permissions(permissions)
            .onExplainRequestReason { scope, deniedList ->
//                val message = "PermissionX需要您同意以下权限才能正常使用"
//                scope.showRequestReasonDialog(deniedList, message, "Allow", "Deny")
            }
            .request { allGranted, grantedList, deniedList ->
                Toast.makeText(this, "granted list $grantedList, \ndenied list $deniedList", Toast.LENGTH_SHORT).show()
            }
    }
aiquantong commented 2 months ago

遇到同样问题