When using Android ACTION_PICK, EXTRA_ALLOW_MULTIPLE, go to Google Photo without selection window

Asked 2 years ago, Updated 2 years ago, 28 views

            Intent intent = new Intent(Intent.ACTION_PICK);
            intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
            intent.setType("image/*");
            startActivityForResult(intent.createChooser(intent,""), PICTURE_REQUEST_CODE);

This is the code to open the gallery I'm using. When you open the gallery using this EXTRA_ALLOW_MULTIPLE, the General Gallery and Google Photo Selection window appear I don't want to make multiple choices in the gallery anyway, and I have to use Google Photos, so I don't want the gallery to appear in the selection window itself. Is there a way to display Google Photos right away other than calling ACTION_PICK?

android java

2022-09-21 12:46

1 Answers

Send users to another app If you look at the document

List<ResolveInfo> activities = packageManager.queryIntentActivities(intent,
            PackageManager.MATCH_DEFAULT_ONLY);

In this way, you can obtain information about the application that can currently operate with that intent.

Also, if you look at the ResolveInfo document, there is a method to import packageName.

I think you can get the Google Photo package name with that method and start it right away without using createChooser.


2022-09-21 12:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.