Skip to content

Android 13 storage permission in @NeedsPermission #781

@gaurav90jain

Description

@gaurav90jain

Need to ask for READ_EXTERNAL_STORAGE) permission for API level lower than 33 and ask for READ_MEDIA_IMAGES permission for API level equal or higher than 33.
then we should use like below
private val readImagePermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
if(ContextCompat.checkSelfPermission(this, readImagePermission) == PackageManager.PERMISSION_GRANTED){
//permission granted
} else {
//permission not granted
}

But post using lib of permission dispatcher
we should use as
@NeedsPermission({Manifest.permission.READ_MEDIA_IMAGES,Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
but it is not working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions