Network Download Status?

So my app allows people to purchase and then download items…some of which could be rather large (10-20MB in size).  I’m wondering if network.download() provides any type of feedback on the download status?  Usually download listeners give you the full size and the downloaded size though I don’t see that in the docs.  I’d like to be able to display a progress bar for the download rather than have some generic activity indicator that gives no indication of wait time.  

 

One option would be to load the file size into a json file and then read that before download…then use lfs to constantly check the local file.  But that seems like a hack.  Any other ideas?

Hi there,

 

This is a feature that was just recently added in the “Networking 2.0” improvements in Daily Build 1043.  You can check out the new documentation here: http://docs.coronalabs.com/daily/api/library/network/download.html and http://docs.coronalabs.com/daily/api/event/networkRequest/index.html.

 

  • Andrew

Perfect!  Thanks, Andrew.   

Hi there,

 

This is a feature that was just recently added in the “Networking 2.0” improvements in Daily Build 1043.  You can check out the new documentation here: http://docs.coronalabs.com/daily/api/library/network/download.html and http://docs.coronalabs.com/daily/api/event/networkRequest/index.html.

 

  • Andrew

Perfect!  Thanks, Andrew.   

Thanks for sharing the news about that progress bar and progress updates on downloads.  I have been waiting for this for a long time!

I have one question, would anyone know how to incorporate the new download progress feature into Graham Ransons FTP-Helper code?

http://developer.coronalabs.com/code/ftp-helper

I am using his FTP-Helper code to download a zip file from an ftp server, but I really want to use this download progress feature which appears to only be part of the network.request API.

Any thoughts would be great!

Or for that matter, maybe I just need to learn how to work with Corona’s built in FTP stuff?

network.* API’s are not FTP, they are HTTP based.  They are totally different protocols.  FTP doesn’t use URL’s to find things like HTTP does.  But if your content can be gotten to with a URL, you can use network.download() just fine.  It will operate on the hosts HTTP port 80 or HTTPS port 443, where as FTP runs on port 21 (could impact things behind a firewall)

I understand.  I wanted to use FTP just as a way to protect my downloadable content so not anyone with just the URL could get to it.  But it sounds like there is no way to use FTP and be able to get download progress of the file?

I’m not saying if you can or cant.  That’s something to ask Graham or for you to look at the FTP code and see if you get the filesize passed to you before you start downloading and if there is any thing that is looping and getting blocks, or if it just downloads the whole file.  I don’t have any experience with that, so Graham will be  your best resource or studying the code.

Alright, is there a way I can contact specific people on the forums? the comments on that FTP-Helper page seem locked so I don’t have a way to contact Graham.

You could try googling him and see if you can find a public contact for him.  He also goes by Glitch Games.

@rob,

I haven’t been able to hear back from Graham.

I am wondering, do you think it would be possible if I knew the size of the file I am trying to download, to then just check file size locally on the device as the file downloads so I could see how far along the download progress is?

That’s usually the way it works.  You get the size of the file and then your amount downloaded / total size = percent downloaded.

Great I will give that a try, thanks for your time.

@Rob.  When I start my file download, the app freezes to the point that I can’t do anything until the file is fully downloaded, meaning that I can’t even be checking the file size.  I wonder whats going on, I thought that file download was asynchronous?

I think I am just going to break down and use the network.request API with the new progress listener.  I just wanted to try and protect my app assets by using FTP.  Hopefully the Zip plugin will get password protection soon!

The FTP uses the Lua socket support which is blocking.   network.* API calls are async and will work

Thanks for sharing the news about that progress bar and progress updates on downloads.  I have been waiting for this for a long time!

I have one question, would anyone know how to incorporate the new download progress feature into Graham Ransons FTP-Helper code?

http://developer.coronalabs.com/code/ftp-helper

I am using his FTP-Helper code to download a zip file from an ftp server, but I really want to use this download progress feature which appears to only be part of the network.request API.

Any thoughts would be great!

Or for that matter, maybe I just need to learn how to work with Corona’s built in FTP stuff?