Android 12 Developer Preview is here! Try it out, and give us your feedback!

Package visibility in Android 11

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:

  1. Install Android Studio 3.6.1 or higher.
  2. Install the latest version of Gradle that Android Studio supports.
  3. Set your app's targetSdkVersion to 30.
  4. Don't include the <queries> element in your app's manifest file.
  5. Call getInstalledApplications() or getInstalledPackages(). Both methods should return a filtered list.
  6. See which features of your app aren't working.
  7. 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:

Blog posts