安装一个apk文件源代码

 /**
  * 安装一个apk文件
  *
  * @param file
  * 要安装的完整文件名
  */
 protected void installApk(File file) {
  // 隐式意图
        Log.e("OpenFile", file.getName());
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(android.content.Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file),
                        "application/vnd.android.package-archive");
        startActivity(intent);
 }
原文地址:https://www.cnblogs.com/common1140/p/3751553.html