androidusage-statisticsinstalled-applications

Get all installed apps in android 11 (API 30) , how to get all other apps installed in android 11?


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.


Solution

  • 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>