Reputation: 1093
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.
Upvotes: 4
Views: 8873
Reputation: 33
Don't need ask permission for this. They do not exist for Android 13+ devices anymore. You have WRITE permission by default in all public directories on external storage. You can access all files without any permission.
Upvotes: 2
Reputation: 467
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.
Upvotes: 0