guolindev / PermissionX

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

android 13 POST_NOTIFICATIONS ask issue #202

Closed bhavin-qfonapp closed 2 years ago

bhavin-qfonapp commented 2 years ago

When ask android.permission.POST_NOTIFICATIONS it's not showing onForwardToSettings and onExplainRequestReason.

PermissionX.init(activity)
                    .permissions(POST_NOTIFICATIONS)
                    .onExplainRequestReason { scope, deniedList ->
                        scope.showRequestReasonDialog(
                            deniedList,
                            "Core fundamental are based on these permissions",
                            "OK",
                            "Cancel"
                        )
                    }
                    .onForwardToSettings { scope, deniedList ->
                        scope.showForwardToSettingsDialog(
                            deniedList,
                            "You need to allow necessary permissions in Settings manually",
                            "OK",
                            "Cancel"
                        )
                    }
                    .request { allGranted, grantedList, deniedList ->
                        if (allGranted) {
                            Toast.makeText(this, "All permissions are granted", Toast.LENGTH_LONG)
                                .show()
                        } else {
                            Toast.makeText(
                                this,
                                "These permissions are denied: $deniedList",
                                Toast.LENGTH_LONG
                            ).show()
                        }
                    }
guolindev commented 2 years ago

Please upgrade to 1.7.1 version. The problem would be fixed.