0

How do I get list of android apps ID which were installed on smartphone?. All android application will have its unique ID. Is it possible to retrieve ID?

Karthik
  • 1
  • 2

1 Answers1

0

Android unique app id is its package name

You can get the user installed apps like this:

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)
    {
        String appName = packInfo.applicationInfo.loadLabel(getPackageManager()).toString();
        Log.e("App № " + Integer.toString(i), appName);
    }
}

Or all the apps (including the system apps):

List<PackageInfo> packList = getPackageManager().getInstalledPackages(0);
for (int i=0; i < packList.size(); i++)
{
    PackageInfo packInfo = packList.get(i);
    String appName = packInfo.applicationInfo.loadLabel(getPackageManager()).toString();
    Log.e("App № " + Integer.toString(i), appName);
}
Michael A
  • 5,770
  • 16
  • 75
  • 127