Android 11 changes how apps can query and interact with other
apps that the user has installed on a device. Using the <queries>
element,
apps can define the set of other packages that they can access. This element
helps encourage the principle of least privilege by telling the system which
other packages to make visible to your app, and it helps app stores like Google
Play assess the privacy and security that your app provides for users.
If your app targets Android 11 or higher, you might need to add
the <queries>
element in your app's manifest file. Within the <queries>
element, you can specify packages by name, by intent signature, or by provider
authority.
Learn more in the guide about how to manage the package visibility of other installed apps when your app targets Android 11 or higher.
Test the change
To test whether this behavior change has taken effect in your app, complete the following steps:
- Install Android Studio 3.6.1 or higher.
- Install the latest version of Gradle that Android Studio supports.
- Set your app's
targetSdkVersion
to30
. - Don't include the
<queries>
element in your app's manifest file. - Call
getInstalledApplications()
orgetInstalledPackages()
. Both methods should return a filtered list. - See which features of your app aren't working.
- Introduce appropriate
<queries>
entries to fix these features.
Additional resources
For more information about the package visibility changes in Android 11, view the following materials: