在下载新版android时使用对话框显示完整操作

在下载新版android时使用对话框显示完整操作,android,Android,我想以编程方式更新我的应用程序。运行应用程序后,在下载过程中会出现“使用完成操作”对话框。我不知道原因是什么。我的代码如下: private BroadcastReceiver downloadReceiver = new BroadcastReceiver() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onReceive(Context context, Intent inten

我想以编程方式更新我的应用程序。运行应用程序后,在下载过程中会出现“使用完成操作”对话框。我不知道原因是什么。我的代码如下:

private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void onReceive(Context context, Intent intent) {

        // check if the broadcast message is for our Enqueued download
        long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
        if (downloadReference == referenceId) {

            try{
            Log.v(LOG_TAG, "Downloading of the new app version complete");
            // start the installation of the latest version
            Intent installIntent = new Intent(Intent.ACTION_VIEW);


             intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");


            installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(installIntent);
            }
            catch(Exception ex)
            {
            String mess=    ex.getMessage();
            String a=mess;
            }

        }
    }
};

您似乎没有任何意图过滤器。请使用标记添加它们


您似乎没有任何目的过滤器。请使用标记添加它们