ConnectionRequest pause() and resume()

久未见 提交于 2020-06-26 06:14:23

问题


Are ConnectionRequest methods named pause() and resume() really implemented?

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

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?

Thank you


回答1:


It looks like they are implemented but notice you need to override isPausable() to return true which currently no ConnectionRequest does.

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.



来源:https://stackoverflow.com/questions/62108128/connectionrequest-pause-and-resume

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