简体   繁体   中英

Android Package Manager List Doesn't Show Navigation Icon

I'm using the below code to get a list of applications:

    List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
    Collections.sort(packages, new ApplicationInfo.DisplayNameComparator(pm));
    for (int i = 0; i < packages.size(); i++) {
        if (packages.get(i).uid > 10000) {
            try {
                Log.d(pm.getApplicationLabel(packages.get(i));
            } catch (NameNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

Now the issue is that there are some applications that don't show in the list, such as Google Navigation. Any idea why this is?

This is what I ended up using that worked perfectly:

Intent applications = new Intent(Intent.ACTION_MAIN);
applications.addCategory(Intent.CATEGORY_LAUNCHER);
applicationIntentList = pm.queryIntentActivities(applications, 0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM