Reputation: 101
What is the use of Application info and how to use it. I'm confused how to retrieve the installed apps from the device and to display it with logo Can anyone please help me to sort it out. Differentiate the terms applicaiton info, package info and resolve info.
Upvotes: 0
Views: 3293
Reputation: 13917
to display a list of installed apps, you can try this
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
You will get all the necessary data in the ResolveInfo to start a application. You can check ResolveInfo
or try this code
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ArrayList<ResolveInfo> list = (ArrayList<ResolveInfo>)
pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
System.out.println("Installed Applications " + rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
}
Upvotes: 5