Cancelling ongoing download does not remove notification

↘锁芯ラ 提交于 2020-01-15 03:30:11

问题


I am using Android DownloadManager, and have the ability to cancel ongoing download. This call also removes download progress from notification bar on all device I tested but from Nexus 5(running Android 5.0.1). Behavior is download is canceled but notification is not and get stuck at percentage complete when cancel was requested.

Here is how I set request object to display notification

DownloadManager.Request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

And this is the relevant log message output I see after I call

DownloadManager.remove(downloadId);

01-12 13:37:41.205      746-746/? V/NotificationService﹕ pkg=com.android.providers.downloads canInterrupt=false intercept=true
01-12 13:37:41.385   21155-7714/? W/DownloadManager﹕ [5020] Stop requested with status CANCELED: download canceled
01-12 13:37:41.385   21155-7714/? D/DownloadManager﹕ [5020] Finished with status CANCELED

回答1:


To resolve this issue I had to call DownloadManager#remove() twice.



来源:https://stackoverflow.com/questions/34751798/cancelling-ongoing-download-does-not-remove-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!