如何在使用DownloadManager点击通知后在android中打开下载应用程序

时间:2017-01-07 01:00:01

标签: android android-notifications android-download-manager

在这里,我使用DownloadManger进行下载,它将显示通知栏中的进度

DownloadManager.Request request = new DownloadManager.Request(uri);
            request.setTitle("Data Download");
            //Setting description of request
            request.setDescription("Android Data download using DownloadManager.");
            request.allowScanningByMediaScanner();
            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

registerReceiver(downloadReceiver, filter);

在下载过程中接收点击操作(DownloadManager.ACTION_NOTIFICATION_CLICKED)的广播接收器,下载过程中的操作正在运行

private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {



            String action = intent.getAction();

            if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action))
            {
               startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
            }


        }
    };

但下载后DownloadManager.ACTION_NOTIFICATION_CLICKED无法重定向到下载应用。 任何人都可以帮助我如何在点击DownloadManger通知(完成下载后)下载应用程序后重定向????????????

0 个答案:

没有答案