0

i get the all install app in my phone by this method.its working fine

public static List getInstalledApplication(Context c) {
            return c.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
        }

but its return all apps include all system apps. i do not want system app i just want to get the user install app will you please help me how to get the the only user install apps in my phone not system apps.thanks in advance

faisal iqbal
  • 724
  • 1
  • 8
  • 20

1 Answers1

0

Just use this:

List<ApplicationInfo> apps = getPackageManager().getInstalledApplications(0);
for(ApplicationInfo app : apps) {
    if((app.flags & (ApplicationInfo.FLAG_UPDATED_SYSTEM_APP | ApplicationInfo.FLAG_SYSTEM)) > 0) {
        // It is a system app
    } else {
        // It is installed by the user
    }
}

You can make a separate array and then add user installed apps in this form the else statement. Such as:

else {
        // It is installed by the user
        UserAppArray<ApplicationInfo>.add(app);
    }
Saini
  • 734
  • 3
  • 8