android 在代码中安装apk的方法

第一步:保存apk文件到sdcard或者其他地方

第二步:修改apk文件的权限为可执行 ,例如chmod ‘777’ file:

String command     = "chmod " + permission + " " + path;
Runtime runtime = Runtime.getRuntime();
runtime.exec(command);

第三步:使用Intent 调用安装:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.parse("file://" + path),"application/vnd.android.package-archive");
context.startActivity(intent);
原文地址:https://www.cnblogs.com/lipeil/p/2666782.html