question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[KTX] System dialog doesn't show up, after manually disable permission from setting

See original GitHub issue

Overview

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:closed
  • Created 3 years ago
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
TurKurT656commented, Jan 18, 2021

I’m using api level 29. I’ll try to make a sample project and share it with you.

1reaction
hotchemicommented, Mar 29, 2021

got it for point 1 and 3. for point 2, let me think it over…it may have some degrades from my initial design 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permissions Dialog not showing in Android 11 - Stack Overflow
Show activity on this post. The system resets only runtime permissions, which are the permissions that display a runtime prompt to the user ......
Read more >
Making permissions auto-reset available to billions more ...
Permissions are reset by default for apps targeting Android 11 or later. The user can manually enable auto-reset for apps targeting Android ...
Read more >
Use Kotlin coroutines with lifecycle-aware components
Lifecycle-aware coroutine scopes. Lifecycle-aware components define the following built-in scopes that you can use in your app. ViewModelScope.
Read more >
Set up a Firebase Cloud Messaging client app on Android
Your app will not be allowed to show notifications until the user has granted this permission. To request the new runtime permission: Java...
Read more >
CIMPLICITY 11 - Device Communications - General Electric
Information contained herein is subject to change without notice. © 2020, General Electric Company. All rights reserved. Trademark Notices. GE, the GE Monogram, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found