Android gets a list of all installed apps
I got a list of installed apps 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 only lists the apps with active action. How can I get a list of all installed applications? Note that I used this code in a project that needs the List to have a ResolveInfo, so please only answer the code that returns a ResolveInfo list.
source to share
Your question is not entirely clear; you are making a bit of an unreasonable request. You say you want a list of all installed applications, but you also want List
objects ResolveInfo
. The docsResolveInfo
describe it as:
Information returned when resolving intent against IntentFilter.
Applications and IntentFilter
do not correlate with each other. What would you like the objects to ResolveInfo
contain? If there is more than one package for a package, which one do you want?
PackageManager
includes a method getInstalledApplications
but returns List
objects ApplicationInfo
, which is more appropriate enter this query. There is also a method getInstalledPackages
that returns List
objects PackageInfo
.
source to share