incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Sawatzki <>
Subject Improving the new download function
Date Sun, 18 Dec 2011 15:29:47 GMT
Hi list,

first of all I'd like to thank everybody involved in the project for the
excellent work you have done! I am using phonegap/callback for an app
that gives teachers and students access to educational resources like
video clips, documents, charts and interactive materials which are
distributed online by the state of Lower Saxony (Germany).
The app not only allows to bookmark items and manage items in folders,
but should provide a way to download the files to the mobile device and
use them offline.

This is where the new function comes in - it
basically works, but has two main issues:

1. You never know when a download is finished. You can just display a
"please be patient" message - if they download a 50 megs video clip they
might get confused if they aren't informed about the progress.

2. There's no way to cancel a download. If somebody accidently clicked
the download button, he has to wait until it is finished or kill the
app/shutdown the device.

I have tried to address issue 1 for the android platform:

How it works:
Use, target, success, error) as usual.

Whenever the download changes it progress, the succes callback is called
with a FileDownloadResult (inspired by FileUploadResult) as parameter,
which looks like this:

    completed: false,
    bytesReceived: 1000,
    bytesTotal: 2000,
    percentCompleted: 50.0,
    responseCode: 200,

When the download has finished, the "completed" property is set to true
and the "fileEntry" property is set and contains the FileEntry object
pointing to the downloaded file.

Have a look at the commit to see how this works:

Keep in mind that this is just a quick prototype that I would like to
share and discuss with you. I'd highly appreciate if you check it out
and tell me your ideas and thoughts. 

I hope this is a good starting point and we can find a good way to get
something like this going in the callback core as soon as possible.
Users will expect this functionality if they download more than a few
hundred kilobytes.

Thanks in advance for your feeback and have a nice day. :o)


View raw message