incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Sawatzki <jo...@joerg-sawatzki.net>
Subject Re: Improving the new download function
Date Mon, 02 Jan 2012 12:21:47 GMT
Hi once again,

first of all, a Happy New Year to everybody on the list! :o)

As I haven't received any feedback in the last two weeks concerning my
proposal, I decided to make things easier for you and created a plugin
approach as well. It allows you to easily try out the extended download
feature without having to touch the core (even though I think this
feature belongs into the core in the long run).

Here's the repository:
https://github.com/joerg86/phoneload

Just follow the steps in Android/README.md and try it out. It should
work perfectly with the new PhoneGap 1.3.0!

Cheers,

Jörg

Am Mittwoch, den 28.12.2011, 15:02 +0100 schrieb Jörg Sawatzki:
> Hey list,
> 
> I hope you all had a nice christmas and didn't spend too much time
> digging through some code these days. :o)
> 
> Here's the latest update concerning the improved download function in
> callback-android: The cancel() function!
> 
> var ft = FileTransfer();
> ft.download("http://foo.bar/download.zip", progessCB, errorCB);
> 
> Now the download starts and calls progressCB with a FileDownloadResult
> (see my last message) periodically. You can now do:
> 
> ft.cancel()
> 
> And the download thread is stopped! This calls errorCB once.
> 
> I am looking forward to your feedback and it would be awesome if we
> could get this feature into core, as I am quite sure that almost every
> user who uses the download function would like to monitor and control
> the transfer.
> 
> All the best for the new year!
> 
> Jörg
> 
> PS: I have some resources available to help with coding. We just need to
> agree how it should be done. I cannot make a decision, but I can make
> the code after the community / project managers have made the decision.
> 
> PPS: Even though I am not an experienced Objective-C developer I'd
> volunteer for the job of implementing these additional functions on
> iPhone as well, if there's nobody else who can do it better and
> faster. :)
> 
> Am Sonntag, den 18.12.2011, 16:29 +0100 schrieb Jörg Sawatzki:
> > 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 FileTransfer.download() 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 FileTransfer.download(source, 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:
> > https://github.com/joerg86/callback-android/commit/f7d94812cdbf4fc8c1e7d343065502a07b85836e
> > 
> > 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)
> > 
> > Jörg
> > 
> 
> 



Mime
View raw message