Privacy Policy About Us Android 11 Flutter


Package visibility 

TARGET 30 - The following behavior changes apply exclusively to apps that are targeting Android 11 or higher.

Before android 11, When developer call packageManager.queryIntentActivities(), It returns all the applications installed in the device.

After targeting Android 11, Developer needs to declare a list of packages/Intent/Authority of target application applications under <queries> in AndroidManifest. Only those listed application will be display in packageManager.queryIntentActivities().

If you want to startActivty or want to startService of other application then, you need to declare that applications package/intent/authority inside <queries>, And target application also need to declare your applications package/intent/authority inside their app manifest.

You can use intent filter to filter wide range of application in <queries>

AndroidManifest.xml

<manifest package="com.example.game">
    <queries>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="image/jpeg" />
        </intent>
    </queries>
    ...
</manifest>

In rare cases, If you want to interact with all installed application, you can use QUERY_ALL_PACKAGES permission.

Exception:  E.g. target app is your own app, interact with the system package, your app is IME app, etc 

Use cases that aren't affected by the change: 

The following types of apps are always visible to your app:

i) Your own app.

ii) Certain system packages, such as the media provider, that implement core Android functionality. The specific set of packages depends on the specific device that runs your app. To view the full list of packages for a specific device, run adb shell dumpsys package queries on that device. In the command output, find the forceQueryable section, where you can view the list of packages.

iii) The app that installed your app.

iv) Any app that launches an activity in your app using the  startActivityForResult() method.

v) Any app that starts or binds to a service in your app.

vi) Any app that accesses a content provider in your app.

vii) Any app that has a content provider, where your app has been  granted URI permissions to access that content provider.

viii) Any app that receives input from your app. This case applies only when your app provides input as an  input method editor.