/**
    * 安装apk
    * @param url
    */
private void installApk(){
File apkfile = new File(apkFilePath);
        if (!apkfile.exists()) {
            return;
        }
        Intent i = new Intent(Intent.ACTION_VIEW); 
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
        i.setDataAndType(Uri.parse("file://" + apkfile.toString()),
          "application/vnd.android.package-archive");
        mContext.startActivity(i);
        android.os.Process.killProcess(android.os.Process.myPid());

}

如果没有android.os.Process.killProcess(android.os.Process.myPid());最后不会提示完成、打开。
如果没有i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);这一步的话,最后安装好了,点打开,是不会打开新版本应用的。

更多相关文章

  1. Android控制闪光灯的方法(打开与关闭)
  2. Cordova + vue 打包安卓(Android) apk 及 Apk版本自动升级及安装
  3. Android(安卓)webView不能响应h5打开相册的操作
  4. 模拟器上安装Android(安卓)Market
  5. 配置Vim开发Android详解
  6. android sdk 安装更新慢:下载android sdk更新包离线安装解决方案
  7. mac 系统下android源码下载以及使用(总结)
  8. mac 系统下android源码下载以及使用(总结)
  9. Android控制闪光灯的方法(打开与关闭)

随机推荐

  1. Android查询短信数据库 查询联系人数据库
  2. PopupWindow 动画显示与消失(逐惭缩放、逐
  3. 如何在Android设备中用NDK编译SQLite并且
  4. android namespace 、样式、主题 (一)
  5. android 封装好的BottomTabBar
  6. Android实现点击两次返回键退出
  7. Android之使用Android-query框架进行开发
  8. AndroidGPS定位详解 (4)
  9. android编译问题,如何控制make编译hdpi,mdp
  10. RelativeLayout的布局学习(部分知识点)