繁体   English   中英

如何检查已安装的应用程序 android

[英]how to check installed apps android

嘿,谁能向我解释一下这个 if 条件,顺便说一句,代码可以工作,但我不明白 if 条件

    PackageManager pm = context.getPackageManager();
    List<ApplicationInfo> apps = pm.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
        }
    }

获取Android已安装应用列表,使用代码如下:

Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> appsList = context.getPackageManager().queryIntentActivities(intent, 0);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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