获取所有已安装的应用程序以及设置,消息,相机/仅应用程序菜单中可见的应用程序

时间:2012-12-03 11:32:52

标签: android

我正在尝试获取包含所有已安装应用程序和少量系统应用程序(如相机,设置,消息)的所有应用程序的列表。我使用

安装了所有用户

ApplicationInfo.FLAG_SYSTEM == 0

和所有系统应用程序    ApplicationInfo.FLAG_SYSTEM == 1, 还有很少的系统应用程序    ApplictionInfo.FLAG_UPDATED_SYSTEM_APP但不是全部

但我希望得到我在手机应用程序部分看到的所有应用程序, 所以任何人都可以帮助我如何过滤掉系统应用程序以仅获取相机,设置,消息等。

1 个答案:

答案 0 :(得分:3)

使用此代码,

    PackageManager pm = this.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
    for (ResolveInfo rInfo : list)
    {
       String str = rInfo.activityInfo.applicationInfo.loadLabel(pm).toString() + "\n";
       ArrayList results = new ArrayList();
       results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
       Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
       icon =  rInfo.activityInfo.applicationInfo.loadIcon(pm);
    }