我在一个活动中实现了DownloadManager。下载工作正常。但是这个类会自动创建一个停留在状态栏的通知。有没有办法删除这个通知。以下是代码:
Uri uri = Uri.parse(url);
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setTitle(fileName);
request.setDescription(fileName);
request.setVisibleInDownloadsUi(false);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
firmwareZipPath = new File(Environment.getExternalStorageDirectory()
+ File.separator
+ Constants.TEST,
type + ".tgz");
request.setDestinationUri(Uri.fromFile(firmwareZipPath));
downloadId = downloadManager.enqueue(request);
我尝试将
request.setVisibleInDownloadsUi
设置为 false。仍然显示通知。