Android 关闭打开/完成安装对话框

Android 关闭打开/完成安装对话框,android,Android,我正在尝试使用用户知识更新我的apk,即用户必须接受权限并单击android的本机安装对话框按钮。 要启动此安装,我使用以下代码: File file = ContentUtils.getFileForResourceId(this, resourceId); Intent promptInstall = new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.fromFile(file),"application/vnd.android.packag

我正在尝试使用用户知识更新我的apk,即用户必须接受权限并单击android的本机安装对话框按钮。 要启动此安装,我使用以下代码:

File file = ContentUtils.getFileForResourceId(this, resourceId);
Intent promptInstall = new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");
promptInstall.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
promptInstall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(promptInstall);
在用户接受所有权限并且安卓系统成功安装了软件包之后,我的应用程序将重定向用户到应用程序的特定活动,而不显示。为此,我使用在添加或替换包时正在收听的广播接收器

问题是,一旦用户进行了更新,每次用户单击本机安装对话框“取消”按钮或的“取消”按钮时,都会出现上一个更新

有没有什么方法可以关闭android finish安装对话框,或者禁用它