How can we get all installed applications in android 11? for Android 10 it is working fine but when I updated to android 11 then all of them are gone.
Asked
Active
Viewed 7,701 times
2 Answers
15
From Android 11 Google has introduced a new permission to query all installed apps on android devices. So if you want to get all applications in yours app for some reason then just add following permission in your manifest
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
or for specific category of apps you can use this in your manifest. for example if you want only apps with android.intent.category.HOME
category then add this code.
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
</intent>
</queries>
also you can filter apps more specifically by adding more categories to it like shown below
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME,android.intent.category.DEFAULT" />
</intent>
</queries>

Ali Imran
- 8,927
- 3
- 39
- 50
-
4Note that Google has stated that your app needs a justification for this permission, or for an overly-expansive `
` element. – CommonsWare Oct 27 '20 at 12:14
3
Update to Above Ali's answer
The queries
tag does not work inside the application
tag, so you have to add it inside the manifest
tag, but outside the application
tag like this
<manifest
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
</application>
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
</manifest>

Abandoned Cart
- 4,512
- 1
- 34
- 41

Quick learner
- 10,632
- 4
- 45
- 55