Android get a list of all installed apps

ptia picture ptia · Jan 24, 2013 · Viewed 12.6k times · Source

I have obtained a list of installed app using this code:

public List<ResolveInfo>() {
    PackageManager pm=getPackageManager();
    Intent main=new Intent(Intent.ACTION_MAIN, null);

    main.addCategory(Intent.CATEGORY_LAUNCHER);

    List<ResolveInfo> launchables=pm.queryIntentActivities(main, 0);

}

There is only a problem: it list only apps that has a MAIN activity. How can I get a List of all installed apps? Note that I used this code in a project that need that the List is of ResolveInfo, so please answer only code that returns a List of ResolveInfo.

Answer

Guillermo Merino picture Guillermo Merino · Jan 24, 2013

Have you tried with:

 List<ApplicationInfo> packages = pm
            .getInstalledApplications(PackageManager.GET_META_DATA);

(found here)