[KTX] System dialog doesn't show up, after manually disable permission from setting
See original GitHub issueOverview
I’ve two permissions in my fragment (camera and storage) this is my code for them:
private fun checkCameraPermission() {
constructPermissionsRequest(
Manifest.permission.CAMERA,
onShowRationale = { request ->
showPermissionRationaleDialog(
Manifest.permission.CAMERA,
onAccept = { request.proceed() },
onDeny = { navigateHome() }
)
},
onPermissionDenied = {
navigateHome()
},
onNeverAskAgain = {
showPermissionNeverAskAgainDialog(
Manifest.permission.CAMERA,
onDeny = { navigateHome() }
)
}
) {
showCamera()
}.launch()
}
private fun checkStoragePermission() {
constructPermissionsRequest(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onShowRationale = { request ->
showPermissionRationaleDialog(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onAccept = { request.proceed() }
)
},
onNeverAskAgain = {
showPermissionNeverAskAgainDialog(Manifest.permission.WRITE_EXTERNAL_STORAGE)
}
) {
saveFile()
}.launch()
}
I’m calling checkCameraPermission()
on my fragment’s onStart()
function. but there is a save button for calling checkStoragePermission()
. Everything works great. until when I go to setting and manually disable storage permission from there. After returning to the fragment when I press the save button, Rationale shows up but when I accept button the system permission dialog doesn’t show up. (I set a breakpoint and I saw that request.proceed()
called. but It doesn’t jump to the requiresPermission
method.)
The Strange part is that If I disable checkCameraPermission()
from onStart()
It will work.
Expected
System dialog shows up event after manually disabling permission from setting
Actual
System dialog doesn’t show up, after manually disable permission from setting (when there is two permission checks on the fragment)
Environment
- Which library version are you using? ktx 1.0.1
- On which devices do you observe the issue? all devices
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (12 by maintainers)
Top GitHub Comments
I’m using api level 29. I’ll try to make a sample project and share it with you.
got it for point 1 and 3. for point 2, let me think it over…it may have some degrades from my initial design 🤔