PackageManager pm = context.getPackageManager();
PackageInfo info = pm.getPackageArchiveInfo(filePath, PackageManager.GET_ACTIVITIES); // filePath为apk文件路径
return info.versionCode; // apk安装包中的版本号
时间: 2024-12-25 19:41:57
PackageManager pm = context.getPackageManager();
PackageInfo info = pm.getPackageArchiveInfo(filePath, PackageManager.GET_ACTIVITIES); // filePath为apk文件路径
return info.versionCode; // apk安装包中的版本号