I can create intent to choose image from gallery on Android in Kotlin like this:
val intentGallery = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
if (intentGallery.resolveActivity(activity.packageManager) != null) {
// Launch the intent
}
What do I need to put in "queries" block in "AndroidManifest" file on Android 11 (API 30) for this code to work?
Adding this code to "queries" block in "AndroidManifest" file, will make it work just fine.
<package android:name="com.google.android.apps.photos" />
But I want to add a code that covers all image galleries, not just Google's.
Reference: https://developer.android.com/training/basics/intents/package-visibility
<queries>
<intent>
<action android:name="android.intent.action.PICK" />
<data android:mimeType="vnd.android.cursor.dir/image" />
</intent>
</queries>
I hope this will help. I used this query parameters and it's works fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With