1、获取所有安装的应用程序
List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packages.size();i++) {
PackageInfo packageInfo = packages.get(i);
AppInfo tmpInfo =new AppInfo();
tmpInfo.appName = packageInfo.applicationInfo.loadLabel(getPackageManager()).toString();
tmpInfo.packageName = packageInfo.packageName;
tmpInfo.versionName = packageInfo.versionName;
tmpInfo.versionCode = packageInfo.versionCode;
tmpInfo.appIcon = packageInfo.applicationInfo.loadIcon(getPackageManager());
}
2、判断是否是系统应用
if((packageInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM)==0)
{
//非系统应用
}
else
{
//系统应用
}
原文地址:http://cbg23.blog.51cto.com/7201812/1620776