Francesco Galgani
Francesco Galgani

Reputation: 6249

ConnectionRequest pause() and resume()

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

Upvotes: 2

Views: 37

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

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.

Upvotes: 1

Related Questions