-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Apps targeting Android 13, openPicker is not working. It does not ask for permission and camera roll does not open. #1849
Comments
@dtumonasingh what device are you testing on ? |
I am testing on Pixel 4 simulator, the app targets Android 13 and the device also is on Android 13. When the app targets Android 12, no matter what the device, the openPicker ask for permission, only on Android 13 we see this problem. My guess is it has something to do with the WRITE_EXTERNAL_STORAGE permission it asks for, |
Adding ACCESS_MEDIA_IMAGES instead of WRITE_EXTERNAL_STORAGE at this line helped me get the permission dialog when opening gallery using the openPicker function. I am not sure what other permission is also needed to be added in place of WRITE_EXTERNAL_STORAGE to give WRITE permission in case of Apps targeting Android 13. According to this Bug from Android 13 the WRITE_EXTERNAL_STORAGE permission does not contain the READ_EXTERNAL_STORAGE permission implicitly, that could be the reason for the openPicker to stop working.. |
@dtumonasingh can confirm this works. May want to close the issue and PR the docs. Thanks a ton 🥳 |
What is the update here. Can guys please merge the above PR. So i can use this in apps targeting android 13. |
@Talhafayyaz11 have you solved? |
i tried to run on real device with appropriate permission and it works find |
Adding this line into android/app/src/main/AndroidManifest.xml fixed mine. |
Uninstall using |
Working for me too |
I recommend you to apply the patch that I mentioned in this PR #1973 (comment) instead of add the READ_MEDIA_IMAGES permission since that permission is not required to open the picker.
Source: https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions |
What version do you use? Should be fixed in v0.39. https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.39.0 |
Yes, But... I'm using version 0.40.0, and when I implemented it, I forgot to add android.permission.READ_MEDIA_IMAGES to my AndroidManifest.xml (because this requirement isn't mentioned in the Readme). Before realizing that I had missed that, I began searching for a solution and implemented another library (react-native-image-picker). I noticed that they could open the picker without requiring any permission on Android 13. So, I started to read their code and I noticed that they were not using the READ_MEDIA_IMAGES permission. Afterward, I checked the Google Documentation and found this sentence:
Source: https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions That is because the picker is part of the OS and there the user can select the picture that he want, so that is the final permission (the user's selection). So, the solution is to simply remove that permission from the code, and you won't need to ask the user for any permission. The same can be done with opening the camera; the CAMERA permission is not required. I have created another PR for that, #1974 |
Thanks, Working for me. |
Same problem with me also |
Even after adding READ_MEDIA_IMAGES to manifest, still not able to select images and files in webview |
Perhaps it seems to be a problem that arises because Android does not allow http. Please build a new Android after changing Android settings as follows.
// you add this |
Perhaps it seems to be a problem that arises because Android does not allow http. Please build a new Android after changing Android settings as follows.
|
Version
Tell us which versions you are using:
Platform
Tell us to which platform this issue is related
Expected behaviour
Camera roll i:e openPicker function should ask for permission
Actual behaviour
Open Picker is not asking for permission
Steps to reproduce
Call OpenPicker function after upgrading app target to SDK 33
Attachments
// stacktrace or any other useful debug info
Love react-native-image-crop-picker? Please consider supporting our collective:
👉 https://opencollective.com/react-native-image-crop-picker/donate
The text was updated successfully, but these errors were encountered: