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.

permissionRequest proceed doesn't work due to KtxPermissionRequest.requestPermission being null

See original GitHub issue

Overview

  • When onLocationShowRationale get called and i want to proceed permissionRequest, system permission dialog is not showing up.

Environment

PermissionsDispatcher KTX

This doesn’t work cause KtxPermissionRequest.requestPermission weakreference got lost and is null

 private fun onLocationShowRationale(permissionRequest: PermissionRequest) {
        findNavController().navigate(
            RoundFormFragmentDirections.actionGlobalAlertDialog(
                messageRes = R.string.NSLocationWhenInUseUsageDescription,
                negativeButtonRes = R.string.global_cancel,
                positiveButtonRes = R.string.dialog_gps_permissions_activate,
                requestCode = REQUEST_CODE_PERMISSION_RATIONAL
            )
        )
        setDialogPositiveClickListener {requestCode, _ ->
            when (requestCode) {
                REQUEST_CODE_PERMISSION_RATIONAL -> {
                    permissionRequest.proceed()
                }
            }
        }
        setDialogNegativeClickListener {requestCode, _ ->
            when (requestCode) {
                REQUEST_CODE_PERMISSION_RATIONAL -> {
                    permissionRequest.cancel()
                    findNavController().popBackStack()
                }
            }
        }
    }

But this works

 private fun onLocationShowRationale(permissionRequest: PermissionRequest) {
        permissionRequest.proceed()
    }

Any help appreciated Thx!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
hotchemicommented, Aug 12, 2021
0reactions
hotchemicommented, Aug 13, 2021

ktx-1.1.2 has been released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PermissionsDispatcher/CHANGELOG.md at master - GitHub
Fix : permissionRequest proceed doesn't work due to KtxPermissionRequest.requestPermission being null. ktx: 1.1.1 2021/08/09.
Read more >
Android M Permissions: onRequestPermissionsResult() not ...
I am in a fragment and I tried calling just requestPermissions, unfortunately it didn't work. I also tried what you mentioned and it...
Read more >
PermissionsDispatcher - bytemeta
permissionRequest proceed doesn't work due to KtxPermissionRequest.requestPermission being null. aa86799. aa86799 CLOSED · Updated 1 year ago ...
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