-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Switch to using photo picker #1288
base: main
Are you sure you want to change the base?
Switch to using photo picker #1288
Conversation
this new photoPicker activity only is generated if the Android version is bigger than 11
… gallery image this new photoPicker activity only is generated if the Android version is bigger than 11. is not installing anything on the phone because we are using only compatible android versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't had time to test this yet, but I have several questions. Could you please look at these?
I've tested and can tell it works on my Android 13 phone. After testing on an Android 5 emulator I kinda understand your decision to have the two code paths as it somehow opens the file manager on Android 5 instead of the gallery. I do still prefer just a single code path, also for consistency in behaviour with other apps. But this needs to be delayed anyway given the Photo Picker currently only shows internal camera images and thus will lack many many images the user my want to select. Maybe it'll get added later. Thanks for your contribution, it's sad Google hasn't developed the Photo Picker in a way where it'll be useful for most users. |
To solve the issue #1261
I apply the logic that is explained here: https://developer.android.com/training/data-storage/shared/photopicker#java
First, I need to look for situations in which the user is allowed to select an image from their gallery or files directory. I found that the user is allowed to select an image in three main cases:
After identify these cases I search the code that display the gallery or the file directory and I adapt that code to use the new photo picker approach instead the old one (Only if the Android version of the phone is superior to Android R (11), because if I want to apply this approach to old versions of android, I need to enable the automatic installation of the backported photo picker module through Google Play services and the issue says that is better to not install things without the permission of the user and I agree with that).
Basically, I add some dependencies of androidx and edit the next functions:
If the phone had an Android version oldest than 11 then the old code is executed, if not then the new photo picker is used.