bundle data in app, or keep on server?

Hi

I’m writing this basic multiple choice flash card app for my students. It’ll contain around 300 ‘cards’ once I’m done. Currently the questions and answer choices are just coded in a table.

A programmer friend of mine suggested that the data could be stored on a server so I could add or update questions without having to republish the app. The app could connect to the server if the device had an internet connection, or use a local copy of the data if not.

I’m wondering how I go about doing this. If the data lives on a server will it still be coded in a table, or in some other form?

thanks in advance,

David

There are plenty of host options on how to do this. 

1.  You could have a master data file that has all your card info and filenames of any images that need to download.  Your app could pick that up, check to see if there any new content and download each piece as needed.

2.  You could have the data in a database and query for anything new since the last time you accessed it, then only download the new content.

3.  You could have a data file with just new information in it and the app grabs any newer files that it has and then downloads them.

Once you have the data, you could have a copy of your table saved in system.DocumentsDirectory that holds a list of all known content (shipped with app and downloaded after the fact).

Hi Rob

thanks for the info. Can you point me towards a document that details how to do this? So far I haven’t had any luck finding one.

thanks!

Well this article talks about using REST API’s with PHP and MySQL to talk to Corona SDK:

http://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/

Look in the documentation for the network.downlaod() API call.

If you want to go poor man server (and you don’t need to track what users have what, etc), you could just make a folder on your server, say /MyAppData. Note that you can’t do much “unique” per user this way though - everyone basically gets everything… Rob’s #1 option above:

In the server folder you could put your main flashcard control / content json with all of your binary/text data and image filenames in a nice json table for your app. You can read and write this json using your app (you would make a switch in your program to be used during develpment to save out a “fully loaded” json for you, which would be your master server file apps download).

So apps would simply download a json from a pre-defined web address( something like http://www.myApp.com/MyAppData/CardList.json), and then do the old json.decode() on the file.

From there, they would compare the local files to the server files and fire off network.requests() to get any missing assets.

I say poor mans because there’s no php code, or pretty much anything server side. Just a new json file for your app to check/download now and then, and maybe some other asset files (which would be referenced in the json table).

A couple of unsung API calls that could be useful in crafting a particular poor man strategy also could be:

http://docs.coronalabs.com/api/library/display/loadRemoteImage.html

http://docs.coronalabs.com/api/library/network/download.html

Down the road, you could update the json and add new files at anytime, the app would download the new json, scan its own filesystem to check for what’s needed, and make network.requests() to download any new files.

awesome, thanks so much for the help. I still have quite a bit to learn (no idea what json is yet) but this has pointed me down the path. thanks again.

There are plenty of host options on how to do this. 

1.  You could have a master data file that has all your card info and filenames of any images that need to download.  Your app could pick that up, check to see if there any new content and download each piece as needed.

2.  You could have the data in a database and query for anything new since the last time you accessed it, then only download the new content.

3.  You could have a data file with just new information in it and the app grabs any newer files that it has and then downloads them.

Once you have the data, you could have a copy of your table saved in system.DocumentsDirectory that holds a list of all known content (shipped with app and downloaded after the fact).

Hi Rob

thanks for the info. Can you point me towards a document that details how to do this? So far I haven’t had any luck finding one.

thanks!

Well this article talks about using REST API’s with PHP and MySQL to talk to Corona SDK:

http://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/

Look in the documentation for the network.downlaod() API call.

If you want to go poor man server (and you don’t need to track what users have what, etc), you could just make a folder on your server, say /MyAppData. Note that you can’t do much “unique” per user this way though - everyone basically gets everything… Rob’s #1 option above:

In the server folder you could put your main flashcard control / content json with all of your binary/text data and image filenames in a nice json table for your app. You can read and write this json using your app (you would make a switch in your program to be used during develpment to save out a “fully loaded” json for you, which would be your master server file apps download).

So apps would simply download a json from a pre-defined web address( something like http://www.myApp.com/MyAppData/CardList.json), and then do the old json.decode() on the file.

From there, they would compare the local files to the server files and fire off network.requests() to get any missing assets.

I say poor mans because there’s no php code, or pretty much anything server side. Just a new json file for your app to check/download now and then, and maybe some other asset files (which would be referenced in the json table).

A couple of unsung API calls that could be useful in crafting a particular poor man strategy also could be:

http://docs.coronalabs.com/api/library/display/loadRemoteImage.html

http://docs.coronalabs.com/api/library/network/download.html

Down the road, you could update the json and add new files at anytime, the app would download the new json, scan its own filesystem to check for what’s needed, and make network.requests() to download any new files.

awesome, thanks so much for the help. I still have quite a bit to learn (no idea what json is yet) but this has pointed me down the path. thanks again.