Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

onRequestPermissionsResult is not executed when requesting permission from a Fragment #321

Open
risalfajar opened this issue Mar 8, 2021 · 1 comment

Comments

@risalfajar
Copy link

Basic Information

Device type: Emulator
OS version: API 30
EasyPermissions version: 3.0.0

Describe the problem

What happened?
onRequestPermissionsResult not executed when requesting permission from a Fragment

What did you expect to happen?
onRequestPermissionsResult must be executed

Code and logs

class SampleFragment : Fragment() {
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        EasyPermissions.requestPermissions(
            this,
            "Aplikasi ini memerlukan akses ke lokasi Anda",
            RC_LOCATION_PERMISSION,
            ACCESS_FINE_LOCATION
        )
    }

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        Timber.d("Permission result")
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
    }
}

The "Permission result" log never appeared

@basit112
Copy link

it is because of super.onRequestPermissionsResult(requestCode, permissions, grantResults) Unit' is deprecated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants