如何暂停从DownloadProvider下载项目? [英] How to pause a download item from DownloadProvider?

查看:416
本文介绍了如何暂停从DownloadProvider下载项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看下载管理器的文件,但我找不到暂停下载项目的API。在我的应用程序,用户可以管理下载任务。我知道如何取消下载项目,但似乎没有办法暂停/恢复下载项目。

I have check the document about DownloadManager, but I can not find the API to pause the download item. in my app, user can manage the download task. I know how to cancel the download item, but it seems there is no way to pause/resume the download item.

我必须由我自己写的下载?似乎推倒重来。

Do I have to write the download by myself? it seems reinvent the wheel.

推荐答案

由于对此没有API,你不能直接做。下载管理器以异步方式工作,所以暂停/恢复并不真正适合这种模式。你请求一个文件,它在后台下载当它完成,你就会得到通知。你有什么用暂停/恢复反正好处?

Since there is no API for this, you can't directly do it. The download manager works asynchronously, so pausing/resuming doesn't really fit this model. You request a file, it is downloaded in the background, you get notified when it's done. What do you have to gain by pausing/resuming anyway?

从技术上讲,如果您请求下载通过WiFi只,然后从你的应用程序禁用无线网络,下载将被暂停。但你可能不希望这样做。

Technically, if you request a download over WiFi only, and then disable WiFi from your app, the download will be paused. But you probably don't want to do this.

这篇关于如何暂停从DownloadProvider下载项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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