When an app targets Android 11 (API level 30) or higher and queries for information about the other apps that are installed on a device, the system filters this information by default. This filtering behavior means that your app can’t detect all the apps installed on a device, which helps minimize the potentially sensitive information that your app can access but doesn't need to fulfill its use cases.
Also, filtered package visibility helps app stores like Google Play assess the privacy and security that your app provides for users. For example, Google Play considers the list of installed apps to be personal and sensitive user data.
Limited app visibility affects the results returned by methods that give
information about other apps, such as
The limited visibility also affects explicit interactions with other apps, such
as starting another app's service.
Some packages are visible
automatically. Your app can always
detect these packages in its queries for other installed apps. To view other
packages, declare your app's need for increased package
visibility using the
<queries> element. The use
cases page provides examples of how you
can selectively expand package visibility. The workflows described there allow
you to fulfill common app interaction scenarios while protecting user privacy.
In the rare cases where the
<queries> element doesn't provide adequate package
visibility, you can use the
QUERY_ALL_PACKAGES permission. If you publish your
app on Google Play, your app's use of this permission is
subject to approval.
The page about testing package visibility behavior offers suggestions for how to test behavior changes based on package visibility when your app relies on interactions with other apps.
To learn more about package visibility on Android, view the following materials:
- Package visibility in Android 11, available on Medium.