How to download a new batch of files to a users existing app

So I have searched for a while and can’t seem to find any answers of the fundamental steps necessary to download a batch of files and use them in an existing app. In my case I just released a “ebook” type app, but its only the first story, I would like to allow the user to be able to download the second story from inside the app. Is this possible to do with Corona? How do you get the downloaded files to be in the same location as the original apps files? Do you use an XML file to tell the app how many files there are?

Just hoping that someone with any experience with this can shed some light on the whole process. I really am hoping Corona can handle something like this.

Thanks in advance [import]uid: 19620 topic_id: 34372 reply_id: 334372[/import]

First, you can’t download to the original location. That is the resource bundle (system.ResourcesDirectory) and it’s read only. You can download to system.DocumentsDirectory or system.CachesDirectory (Apple wants downloadable content to go here). Your app would need to be able to read the content from these places.

You cannot download any executable content, but you can download data, text, images, sounds and such. You can use XML or JSON (JSON works much better IMHO).

You can tell your app to download a bunch of small files, or you can use the “tar” module to build one file to download, then unpack the tar file once it’s downloaded into one of the downloadable folders.

[import]uid: 199310 topic_id: 34372 reply_id: 136682[/import]

That makes sense, so I will need to find a way to have my app get the first stories resources from the “system.resourcesdirectory” and any additional downloaded content from “system.CachesDirectory”. When you say that I cannot download any executable content, does that mean that I cannot download any .lua files? I use a lua file that has TONS of data on where things in the stories should be positioned and what not.

Do you know of any forum threads or any tutorials handling any of what we are talking about? Anything about how to use the “tar” module?

As usual thanks for your help Rob. [import]uid: 19620 topic_id: 34372 reply_id: 136706[/import]

You cannot execute a Lua file that you download. But you can download a JSON file, open it, read it and turn it into a Lua table.

For an app I’m wrapping up, I have some content in system.ResourcesDirectory and the downloaded in system.CachesDirectory. In my case they are separate playable games (they all use the same code, I just download the images/audio that I need to play the other variants of the game. In my table that has all the game info, I have an entry for if it’s local or remote and when I load resources, I know if I need to look in which ever directory I need to.
[import]uid: 199310 topic_id: 34372 reply_id: 136731[/import]

Great, thats some good information there. In regards to downloading your files, I thought to have heard that Corona currently does not support a way to know how much of a file has downloaded? Is this true or is there a way to have a progress bar for users? [import]uid: 19620 topic_id: 34372 reply_id: 136744[/import]

First, you can’t download to the original location. That is the resource bundle (system.ResourcesDirectory) and it’s read only. You can download to system.DocumentsDirectory or system.CachesDirectory (Apple wants downloadable content to go here). Your app would need to be able to read the content from these places.

You cannot download any executable content, but you can download data, text, images, sounds and such. You can use XML or JSON (JSON works much better IMHO).

You can tell your app to download a bunch of small files, or you can use the “tar” module to build one file to download, then unpack the tar file once it’s downloaded into one of the downloadable folders.

[import]uid: 199310 topic_id: 34372 reply_id: 136682[/import]

That makes sense, so I will need to find a way to have my app get the first stories resources from the “system.resourcesdirectory” and any additional downloaded content from “system.CachesDirectory”. When you say that I cannot download any executable content, does that mean that I cannot download any .lua files? I use a lua file that has TONS of data on where things in the stories should be positioned and what not.

Do you know of any forum threads or any tutorials handling any of what we are talking about? Anything about how to use the “tar” module?

As usual thanks for your help Rob. [import]uid: 19620 topic_id: 34372 reply_id: 136706[/import]

You cannot execute a Lua file that you download. But you can download a JSON file, open it, read it and turn it into a Lua table.

For an app I’m wrapping up, I have some content in system.ResourcesDirectory and the downloaded in system.CachesDirectory. In my case they are separate playable games (they all use the same code, I just download the images/audio that I need to play the other variants of the game. In my table that has all the game info, I have an entry for if it’s local or remote and when I load resources, I know if I need to look in which ever directory I need to.
[import]uid: 199310 topic_id: 34372 reply_id: 136731[/import]

Great, thats some good information there. In regards to downloading your files, I thought to have heard that Corona currently does not support a way to know how much of a file has downloaded? Is this true or is there a way to have a progress bar for users? [import]uid: 19620 topic_id: 34372 reply_id: 136744[/import]

I’m wondering also if there is a way to have a progress bar for users… [import]uid: 44013 topic_id: 34372 reply_id: 143157[/import]

I’m wondering also if there is a way to have a progress bar for users… [import]uid: 44013 topic_id: 34372 reply_id: 143157[/import]

I’m wondering also if there is a way to have a progress bar for users… [import]uid: 44013 topic_id: 34372 reply_id: 143157[/import]

I’m wondering also if there is a way to have a progress bar for users… [import]uid: 44013 topic_id: 34372 reply_id: 143157[/import]