Android Intent Filter Package Visibility with <queries> Element
0 reputation · 18 May 2023, 18:41 UTC
Implicit Intent Resolution and Package Visibility
Android 12 (API 31) introduced stricter package visibility requirements to enhance user privacy. Applications targeting this API level or higher must declare the packages, intent filters, or providers they intend to interact with using the <queries> element in the AndroidManifest.xml.
When using implicit Intents to communicate between two separate applications, the sending app must have the appropriate visibility permissions to detect if a matching receiver exists. Without this declaration, methods like PackageManager.resolveActivity()` may return null even if a compatible application is installed on the device.
There is uncertainty regarding the most efficient way to declare visibility when the target application is not known by package name but is identified by a specific custom action string.
- Does declaring a specific
<intent-filter>within the<queries>block provide the same visibility as declaring a specific package name? - What is the impact on system performance when using broad intent-filter queries versus explicit package declarations?