今晚查了很多资料,android代码安装APK
BaseHelper.chmod("777", cachePath);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.parse("file://" + cachePath),
"application/vnd.android.package-archive");
this.startActivity(intent);
/**
* 获取权限
*
* @param permission
* 权限
* @param path
* 路径
*/
public static void chmod(String permission, String path) {
try {
String command = "chmod " + permission + " " + path;
Runtime runtime = Runtime.getRuntime();
runtime.exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}