API 30 Problem with permission when trying select image from gallery
See original GitHub issueWhen an app is targeting SDK 30 the problem occurs. Library throws exception while selecting image from gallery.
com.kbeanie.multipicker.api.exceptions.PickerException: java.io.FileNotFoundException: /storage/emulated/0/.../IMG_20210608_12494-2.jpg: open failed: EPERM (Operation not permitted)
… - rest of folder path
Capture image via Camera or record video still working.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Permissions related error in Android API level 30 #776 - GitHub
I know this is working great till API Level 29 but in latest API level 30 - I see error after taking picture...
Read more >API 30 Problem with permission when trying select image from ...
API 30 Problem with permission when trying select image from gallery.
Read more >Query all images from phone works on api 18 but not on api 30
Solution was by asking for permissions again at runtime so that is my code that worked for me after reading the following tutorial...
Read more >Permissions updates in Android 11 - Android Developers
Starting in Android 11, whenever your app requests a permission related to location, microphone, or camera, the user-facing permissions dialog contains an ...
Read more >Accessing the Camera and Stored Media - CodePath Cliffnotes
The easy way - launch the camera with an intent, designating a file path, and handle the onActivityResult. · The hard way -...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @philippeehlert.
Yes thanks to @matale I found next solution:
"Seems to work if you set the caching method as INTERNAL_APP_DIR. The default and other options seem to check for WRITE EXTERNAL STORAGE permission which you will not have in Android 30.
The issue is that in Android 30 there is no more permission to write to external storage, even if declared it does nothing unless your App has the MANAGE_EXTERNAL_STORAGE permission which is will require manual approval of your App, you will not get this approval in most cases.
While you always have access to internal App storage no permission necessary.
So when you create the picker set the Cache.
val picker = MediaPicker(this) picker.setCacheLocation(CacheLocation.INTERNAL_APP_DIR)"
Hello @rubapigh! Just to let you know that this change fixed the error. Selecting image from gallery works now.
Thank you again!