Android如何获取手机上面已经安装的app

PackageManager mPackageManager = getPackageManager();
mPackageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES );

这样就获取到了系统上面所有的app.

那么如何获取到非系统的app呢?

其实很简单,我们只需要做个简单的判断就行了,如:

  1. final PackageInfo packageInfo = mPackageInfoList.get(i);  
  2.                 if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {  
  3.                     //添加自己的代码即可

相关推荐