public static boolean InstallPkgByFile(Context context, String strFilePath,
String strFileName) {
File file = new File(strFilePath + File.separator + strFileName);
if (file.exists()) {
Intent intent = new Intent(Intent.ACTION_VIEW);//关键就是这儿了
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
context.startActivity(intent);
return true;
} else {
return false;
}
}
Android用代码安装APK,不用选择“打包安装程序”
最新推荐文章于 2022-05-20 18:37:46 发布