READ_EXTERNAL_STORAGE permission Not asking in Android 13

Viewed 79

android.Manifest.permission.WRITE_EXTERNAL_STORAGE]

am try to read the Files(pdf and docs) from the storage before that device not asking the permission.

String[] PERMISSIONS = {Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE};

private void requestPermission() {

    ActivityCompat.requestPermissions((Activity) this, PERMISSIONS, PERMISSION_REQUEST_GALLERY_CODE);

 }

suggest me any changes for android SDK 33 new updates.

1 Answers

You can no longer use WRITE_EXTERNAL_STORAGE permission in Android 11+ if u want to access directories other than your app's private folder.

You can read more about it here -> https://developer.android.com/about/versions/11/privacy/storage

If u just need to read PDF's and images from the device, u don't need the WRITE_EXTERNAL_STORAGE permission. Just ask for READ_STORAGE_PERMISSION and u can read files as long as they are not in other app's private folders.

Related