2

Alrright here's what I'm trying to do. I'm using this code:

final PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.PERMISSION_GRANTED);
for (ApplicationInfo packageInfo : packages) {
    if ((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 1)
    {
        //irrelevant code here
    }
}

To filter out the system packages from the user applications for an application launcher. The problem with this approach is that it also filters out apps like the Camera app. What can I do so that it doesn't exclude these apps that are somewhat essential to be in an application launcher but are already part of the Android OS?

I hope you understood what I'm trying to say...

Taranasus
  • 493
  • 5
  • 11

1 Answers1

0

The following solution worked for me.

Instead of

(packageInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 1

use

pm.getLaunchIntentForPackage(app.packageName) != null
fedor.belov
  • 19,444
  • 25
  • 79
  • 121