Mayank Kumar Chaudhari
Mayank Kumar Chaudhari

Reputation: 18766

Is it possible to get list of all the applications that user has installed?

Several games and apps show adds like install the app to get rewards. How does that function? Can I get the list of all the apps that user has installed on his device including uninstalled apps, how?

Upvotes: 1

Views: 78

Answers (1)

Hossam Hassan
Hossam Hassan

Reputation: 791

You can get list of installed non-system apps

 public void installedApps() {
        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);
            }
        }
    }

Upvotes: 1

Related Questions