-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor: Use AndroidX Photo Picker for selecting media #2304
base: main
Are you sure you want to change the base?
refactor: Use AndroidX Photo Picker for selecting media #2304
Conversation
Thanks for submitting @hubatruck. We can confirm that the update works well for our use case, and means all permission checks can be removed once targeting SDK 34. We haven't tested this update when targeting versions prior 34 though. |
@hubatruck Am I doing something wrong? I have errors:
I have target SDK 34 and I added to app/build.gradle
|
Hi @Darex1991 Could you please give a bit more information about your issue? I have ran the project with the example application which also uses Kotlin, and it was not throwing me this kind of error. So it seems like react-native has For easier debugging, the best would be a minimal project that reproduces the issue you mentioned. |
@Darex1991 try adding these to
|
@hubatruck First of all, thank you for this fix! It's been a lifesaver. I'm having an issue on Android 11/12 where the |
@janithl this helped me! Thanks. |
@Darex1991 I'm glad I could help. I'm not 100% sure about the usage of The Photo Picker also falls back to opening documents on older versions of Android if the modular component is not available, which seems to require some sort of read permission:
|
@Darex1991 I hope this post from the Android Developers blog is helpful: https://medium.com/androiddevelopers/permissionless-is-the-future-of-storage-on-android-3fbceeb3d70a |
@janithl I only noticed adding |
Thanks for submitting a PR! Please read these instructions carefully:
main
branch, NOT a "stable" branch.Motivation (required)
What existing problem does the pull request solve?
For a more privacy preserving experience for users, we’re introducing the Photo and Video Permissions policy to reduce the number of apps permitted to request broad photo/video permissions (READ_MEDIA_IMAGES and READ_MEDIA_VIDEO). Apps may only access photos and videos for purposes directly related to app functionality. Apps that have a one-time or infrequent need to access these files are requested to use a system picker, such as the Android photo picker. (effective August 31, 2024)
Reference: https://support.google.com/googleplay/android-developer/answer/13986130
Converted the
launchImageLibrary
Android function to use the native AndroidX Photo Picker: https://developer.android.com/training/data-storage/shared/photopickerTest Plan (required)
Tested out on multiple devices, both with the example app, and on my own project.
Devices used:
Relevant issue: #2146