-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(android): implement Android Photo Picker #14131
base: master
Are you sure you want to change the base?
Conversation
I think I have all parts now 😄 Image, Video, Image & Video. Multiple and single. Multiple with |
|
||
Log.d(TAG, "openPhotoGallery called", Log.DEBUG_MODE); | ||
|
||
Activity activity = TiApplication.getInstance().getCurrentActivity(); | ||
TiActivitySupport activitySupport = (TiActivitySupport) activity; | ||
|
||
TiIntentWrapper galleryIntent = new TiIntentWrapper(new Intent()); | ||
galleryIntent.getIntent().setAction(Intent.ACTION_GET_CONTENT); |
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.
@m1ga Under the hood ACTION_GET_CONTENT
already invokes new Photo picker when it's available, otherwise it invokes system picker. I tested it out on 12.5.1.GA on Android 15 device and it invokes new Photo picker.
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.
Scroll down to ACTION_GET_CONTENT behaviour change
on this page for more details.
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.
ah that is good too know! I thought the new Photo Picker is only used when you use PickVisualMediaRequest as they don't mention the ACTION_GET_CONTENT in their page.
Then I guess we don't need to do anything here :-) I'll put this into draft so we don't need to do anything here but still have to code
@m1ga This major issue is worth keeping an eye even in future as it makes new Photo picker much less useful if it cannot show all albums as of now and unfortunately Google isn't working on this bug. |
Update: As mentioned in a comment below: the current picker will use the new Photo Picker already, so no changes are required. Still keeping this code as it adds
maxImages
and we'll might want to switch laterWill replace the current openPhotoGallery method and use https://developer.android.com/training/data-storage/shared/photopicker
When I was updating an Android app I was asked in the store to use the Photo Picker instead of using
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
. But you could still opt-in for the image permission, so not a high priority for now.I have to call
ActivityResultLauncher
in the BaseActivity otherwise I wasn't able to catch the results. And in order to get the results from the BaseActivity back to MediaModule I use a local Broadcast. Not sure if that is the best way to do it but I didn't find another way.