4

// 我得到了已安装的应用程序列表,但是如何获得预安装的应用程序启用/禁用列表?

PackageManager packageManager = getPackageManager();
List<PackageInfo> packageList = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
String installedAppName=null;
String installedAppPackageName=null;
String installedVersion=null;
for(int i=0;i<packageList.size();i++){
PackageInfo packageInfo = (PackageInfo) packageList.get(i);
installedAppName =  (String) getPackageManager().getApplicationLabel(                       packageInfo.applicationInfo);
installedAppPackageName = packageInfo.packageName;
installedVersion = packageInfo.versionName;
                                    if(installedAppPackageName.equals("com.android.chrome")){
                                        Log.i("installedAppPackageName", installedAppPackageName);
Log.i("installedVersion", installedVersion);
Log.i("Found", "FOUND");

break;
}
}
4

0 回答 0