我有一个使用 Asynctask 从服务器下载 apk 的代码,目前会弹出新的意图并询问用户的权限,如何让应用程序在下载完成后自动安装 apk。我想将安装进度放在通知栏中,就像 google play store 所做的那样:) 下面是我如何显示 apk 的代码:
@Override
protected void onPostExecute(Void unused) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file:///sdcard/MaxApps/3d.apk"), "application/vnd.android.package-archive");
startActivity(intent);
}