Display list of installed apps on Android Device

Hey everyone!

Android provides the PackageInfo class that contains information about the contents of a package. Sometimes, we need to obtain the list of applications installed on an Android device in order to determine whether our application was installed correctly or not.

In this post, I will demonstrate how to obtain the list of all installed applications on your Android device. Since I would be obtaining information about an application, I would also be using the ApplicationInfo class.

Let's begin by creating a new Activity named GetListActivity in any of our existing Android projects. Let the package name be com.example


package com.example;

import java.util.List;
import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.util.Log;

public class GetListActivity extends Activity
	protected void onCreate(Bundle savedInstanceState) 
	public void getInstalledApps()
	    List<PackageInfo> PackList = getPackageManager().getInstalledPackages(0);
	    for (int i=0; i < PackList.size(); i++)
	         PackageInfo PackInfo = PackList.get(i);
		     if(((PackInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) != true)
		          String AppName = PackInfo.applicationInfo.loadLabel(getPackageManager()).toString();
		          Log.e("DeviceApp" + Integer.toString(i), AppName);

Save and run the Activity class. You will see the list of all the applications in the Logcat window!


Hope this helps! Stay tuned for more! 😄