繁体   English   中英

在下载较新版本的android期间使用对话框显示完整操作

[英]show complete action using dialog during download newr version android

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

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;
            }

        }
    }
};

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

<intent-filter>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM