Android R Preview 1 introduced a new permission called QUERY_ALL_PACKAGES
. The documentation for the permission says the following:
Allows query of any normal app on the device, regardless of manifest declarations.
Has anyone worked out what this actually does?
I've tried running the following on the emulator image, and the permission had no effect on either of them:
packageManager.queryIntentActivities(intent, 0)
packageManager.getInstalledPackages(0)
READ_PHONE_STATE is one of the Android permissions categorized as dangerous. This is because it “allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any Phone Accounts registered on the device” [2] .
The QUERY_ALL_PACKAGES permission only takes effect when your app targets Android API level 30 or later on devices running Android 11 or later. To use this permission, your app must fall within permitted uses below, and have a core purpose to search for all apps on the device.
Users are prompted by the runtime permissions dialog to either always allow, allow while in use, or deny permissions. On an OS upgrade to Android 10, permissions given to apps are retained, but users can go into Settings and change them.
If your app needs to access the user's location, you must request permission by adding the relevant Android location permissions to your app. Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION . The permission you choose determines the accuracy of the location returned by the API.
Even when permission QUERY_ALL_PACKAGES
is added, you still need to add <queries>
filter to your AndroidManifest
.
E.g. for the launcher app it might be:
<permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
Android 11 introduces changes related to package visibility. These changes affect apps only if they target Android 11. For more information on these changes, view the guides about package visibility on Android.
https://developer.android.com/training/package-visibility
https://developer.android.com/about/versions/11/privacy/package-visibility
https://developer.android.com/training/package-visibility
For my case, Cordova-android 10.1.1, targetSdkVersion 30
I added
<queries>
<package android:name="com.google.android.gm" />
<package android:name="com.facebook.katana" />
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
in AndroidManifest.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With