vmadalin / easypermissions-ktx

🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.
https://firebaseopensource.com/projects/googlesamples/easypermissions/
Apache License 2.0
380 stars 38 forks source link

Does not work for android 13 & above #21

Open jaffar02 opened 7 months ago

jaffar02 commented 7 months ago

Basic Information

Device type: Emulator OS version: Android 13 EasyPermissions version: v1.0.0

Describe the problem

Application crashes if storage permission is requested on android 13 or above.

What happened? What did you expect to happen? It should prompt request for storage permission on android 13 or above.

Code and logs

No such useful logs or any exception. Just crashes without any useful logs as soon as storage permission is requested.

if (hasReadExternalStorage()) {
   //perform something..
}else {
        EasyPermissions.requestPermissions(
                this,
                "This application must require this permission.",
                PERMISSION_REQUEST_CODE,
                android.Manifest.permission.READ_EXTERNAL_STORAGE
                )
}

private fun hasReadExternalStorage() = EasyPermissions.hasPermissions(
        this, android.Manifest.permission.READ_EXTERNAL_STORAGE)
TwinkyMoon commented 5 months ago

@jaffar02 probably you need follow behaviour changes and use other permissions for Android >= 13 https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions