Android 11 (R) return empty list when querying intent for ACTION_IMAGE_CAPTURE

Android 11 changes how apps can query and interact with other apps.

From the docs:

The PackageManager methods that return results about other apps,
such as queryIntentActivities(), are filtered based on the calling
app’s <queries> declaration.

So you need to declare <queries> in your AndroidManifest.xml:

<manifest package="com.example">
    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>
    ...
</manifest>

Leave a Comment