ConnectionRequest pause()和resume() [英] ConnectionRequest pause() and resume()
问题描述
是否真的实现了名为 pause()
和 resume()
的 ConnectionRequest
方法?
Are ConnectionRequest
methods named pause()
and resume()
really implemented?
从源头上看,我认为它们是伪造的",从某种意义上说,它们实际上什么也没做,只是设置了一个内部标志: https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/io/ConnectionRequest.java
Looking at the sources, I imagined that they are "fake", in the sense they actually do nothing, except setting an internal flag: https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/io/ConnectionRequest.java
因此,我的问题是Codename One是否提供任何暂停方法,然后再继续进行大下载(例如10MB或100MB,这可能是视频的大小).我的想法是在应用程序进入后台时暂停下载,然后在应用程序返回到前台时恢复下载,而无需重新下载已下载的数据:这可以避免我上一个问题中描述的问题:如何改善ConnectionRequest的行为?
So, my question is if Codename One offers any way to pause and then resume a large download (for example 10MB or 100MB, that could be the size of a video). My idea is to pause the download when the app goes to background and then resume it when the app returns to foreground, without re-downloading the already downloaded data: this could circumvent the issue described in my previous question: How to improve the behavior of ConnectionRequest?
谢谢
推荐答案
它们似乎已实现,但请注意,您需要重写 isPausable()
以返回true,而当前没有 ConnectionRequest
可以.
It looks like they are implemented but notice you need to override isPausable()
to return true which currently no ConnectionRequest
does.
在 ConnectionRequest
上添加 setDefaultPausable(boolean)
方法可能更有意义,例如,使用 Rest
API.
It might make sense to add a setDefaultPausable(boolean)
method to ConnectionRequest
to make this usage easier and more universal e.g. with the Rest
API.
这篇关于ConnectionRequest pause()和resume()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!