user3127791
user3127791

Reputation: 101

Usage of Application Info , Package Info and Resolve Info

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

Answers (1)

gaurav5430
gaurav5430

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

Related Questions