取消正在进行的下载不会删除通知 [英] Cancelling ongoing download does not remove notification

查看:75
本文介绍了取消正在进行的下载不会删除通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Android DownloadManager,并且可以取消正在进行的下载.此调用还会从我测试过的所有设备的通知栏中删除下载进度,但来自 Nexus 5(运行 Android 5.0.1).行为是下载已取消,但通知未取消,并且在请求取消时卡在完成百分比.

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

推荐答案

为了解决这个问题,我不得不调用 DownloadManager#remove() 两次.

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

这篇关于取消正在进行的下载不会删除通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆