Android安装后没有完成和打开按钮

                    File apkFile = new File(filePath);
                    Intent intent = new Intent();
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //如果不加,最后安装完成,点打开,无法打开新版本应用。
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
                    startActivity(intent);
                    android.os.Process.killProcess(android.os.Process.myPid()); //如果不加,最后不会提示完成、打开。

 

posted @ 2017-01-04 16:30  飞剑  阅读(717)  评论(0)    收藏  举报