首页 > 代码库 > 取得用户安装的应用程序

取得用户安装的应用程序

 1 private List<PackageInfo> packageInfos; 2 private List<PackageInfo> userPackageInfos; 3  4  5 packageInfos = getPackageManager().getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); 6         userPackageInfos = new ArrayList<PackageInfo>(); 7         for(int i=0; i<packageInfos.size();i++) { 8             PackageInfo temp = packageInfos.get(i); 9             ApplicationInfo appInfo = temp.applicationInfo;10             if((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {11                 //updated system App12                 userPackageInfos.add(temp);13             }14             else if((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) ==0) {15                 // Non-system App16                 userPackageInfos.add(temp);17             }18         }

 

取得用户安装的应用程序