我正在使用Download Manager
.
它可以很好地下载文件并将其放在我想要的位置。但由于某种原因,通知仍然存在,我似乎无法将其删除。下载管理器的代码如下:
mDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
Uri uri = Uri.parse("URL"));
long enqueue = mDownloadManager.enqueue(new DownloadManager.Request(uri)
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
.setAllowedOverRoaming(false)
.setTitle("Title")
.setDescription("File description")
.setDestinationInExternalPublicDir("Folder", "Filename")
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE));
BroadcastReceiver onComplete = new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
Toast.makeText(getApplicationContext(), "Download Completed", Toast.LENGTH_SHORT).show();
}
};
下载后如何删除通知?.
我尝试设置所有不同的通知可见性模式,但没有成功。完成后,我可以从 BroadcastReceiver 做些什么吗?