How do I remove the QUERY_ALL_PACKAGES permission from my android app?

Viewed 2454

My Google Play Update releases have been rejected 3 times due to this feedback from Google.

"Less broad app-visibility method should be used We are unable to approve your app’s use of QUERY_ALL_PACKAGES permission because the declared task can be done with a less broad app-visibility method."

My app doesn't need this permission and I have not declared this permission in my manifest file.

I have added the following queries element to my Manifest file to access the WhatsApp, Gmail package:

    <queries>

    <package android:name="com.whatsapp" />
    <package android:name="com.google.android.gm" />
    <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="text/plain" />
    </intent>

    <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="image/png" />
    </intent>

    <intent>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" />
    </intent>

</queries>

Here is the list of permissions asked:

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- Required only if your app targets Android 13. -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<!-- Required to maintain app compatibility. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="33" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="33" />
<!-- Required only if your app targets Android 13. -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />

So how do I remove the query all packages permission? I don't need it and I have not asked for it.

3 Answers

As mentioned in the comments by @CommonsWare, there was a macro benchmark library that was added to the project initially when it was created. This library was asking for the "QUERY_ALL_PACKAGES" permission. I was unaware of the concept of "merged manifest file" and how different libraries used in the project declare their own permissions in their manifest file.

Removed this library and Now its approved.

Query all packages permission: Less broad app visibility should be used

As Google has updated the policies most of us are getting while publishing the android app on the google play store.

Those who are not aware of QUERY_ALL_PACKAGES permission. Please check the official documents from Google.

Use of the broad package (App) visibility (QUERY_ALL_PACKAGES) permission

Most of us tried uploading builds removing the QUERY_ALL_PACKAGES permission but in that case also, it's got rejected. This is the case with us as well. But to get it approved. We reached out to the google support team then we did the required changes that they suggested and the build got approved.

Following are some suggestions by the Google Support team.

  • Go to the Play Console.
  • Select the app.
  • Go to App bundle explorer.
  • Select the non-compliant APK/app bundle's App version at the top right dropdown menu, and make a note of which releases they are under.
  • Go to the track with the policy issue. It will be one of these 4 pages: Internal / Closed / Open testing or Production.
  • Near the top right of the page, click Create new release. (You may need to click Manage track first)
  • If the release with the violating APK is in a draft state, discard the release.
  • Add the policy compliant version of app bundles or APKs. Please ensure the following:
  • The non-compliant version of app bundles or APKs is under the Not included section of this release. For further guidance, please see the "Not included (app bundles and APKs)" section in this Play Console Help article.
  • The new release is rolled out 100% and completely deactivates the non-compliant APK.
  • To save any changes you make to your release, select Save. When you've finished preparing your release, select Review release.
  • If the non-compliant APK is released to multiple tracks, repeat steps 5-9 in each track.

If you need any help. Keep me posted in the comment section.

I removed the QUERY_ALL_PACKAGES permission from my package but still received rejection mails. However, in the Play Store developer console the status remained 'In Review'.

I contacted the Google Play policy support desk by filling out the following form.

In the call, the servicedesk confirmed that the package was valid and the rejection appears to be wrongly given by Google Play. They said a team will look into it / correct it within 48 hours.

Maybe you could contact the policy team about your problem if it is still unsolved.

Related