Android-安装APK的代码

当下载完APK时,提示安装APK的代码:

File file = new File(Environment.getExternalStorageDirectory(),"xxx.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.fromFile(result),"application/vnd.android.package-archive");
startActivity(intent);

原创:转载请声明出处,谢谢!

猜你喜欢

转载自blog.csdn.net/ming2316780/article/details/51673762
今日推荐