DownloadManager和Android 7.0取消功能 [英] DownloadManager and Android 7.0 Cancel feature

查看:323
本文介绍了DownloadManager和Android 7.0取消功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您使用的是 DownloadManager ,则Android N在下载通知中直接提供了取消 功能。

Android N brought the "cancel" feature directly on the download notification if you're using the DownloadManager.

他们是否添加了任何意图过滤器动作来捕获此事件?

Did they add any intent-filter action to catch this event ?

此时,DownloadManager仅获得3个动作:

At this point DownloadManager gets only 3 actions :


  • ACTION_DOWNLOAD_COMPLETE

> ACTION_NOTIFICATION_CLICKED

ACTION_VIEW_DOWNLOADS

我尝试使用 ACTION_NOTIFICATION_CLICKED 手动取消我的下载,但是如果用户单击取消 按钮,我没有收到通知。

I tried to use ACTION_NOTIFICATION_CLICKED to cancel manually my download but if the user clicks on the "Cancel" button, I'm not notified.

推荐答案

DownloadManager应该发送 ACTION_DOWNLOAD_COMPLETE 如果用户单击取消,则广播到您的应用程序。但这是Android N中的一个已知错误,Android团队正在研究它:

The DownloadManager should send ACTION_DOWNLOAD_COMPLETE broadcast to your app if user click on Cancel. But it is a known bug in Android N, Android team is working on it:

问题219785:在通知中单击取消按钮取消下载时,DownloadManager不会发送ACTION_DOWNLOAD_COMPLETE广播。

我们必须等待修复!

这篇关于DownloadManager和Android 7.0取消功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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