下载后通过DownloadManager打开apk文件

时间:2013-10-10 21:24:15

标签: android apk

我有下载管理器与BrocastReceiver知道下载完成后, 该文件是当前运行的应用程序的新版本 并且两者都有相同的包名称 在我运行下面的代码后,我得到一个弹出屏幕,显示一些应用程序运行下载的apk和我无法安装apk

Intent intent2 = new Intent(Intent.ACTION_VIEW);
Uri apkUri = Uri.fromFile(new File(uriString));
intent.setDataAndType(Uri.fromFile(new File(Environment.DIRECTORY_DOWNLOADS, "kara.apk")),"application/vnd.android.package-archive");
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
startActivity(intent2);

提前感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我使用了2个intent.setDataAndType,问题解决了。