A question that I am regularly ask is how to get data from a remote server (usually stored in a database) to a mobile app.
I wrestled with how best to present this information, whether it should be a series, how many different methods I should include, so many variations that the project was never going to be finished. SO, I rather than have this how to sit for another couple of months, here is a tutorial on at least one approach for getting data from a remote server to a mobile app.
I went with a standard 3-tier architecture for this application to keep thinks simple.
Remote Database: In this tutorial I created a MySQL database on a remote server. It has just one table with 3 fields: id, movie title, and the year the movie was released.
Logic or Middleware: I used php for the middleware to pull the data from the MySQL database and encode it into the JSON format before returning it to the mobile device:
Client : This is the Corona SDK code that I used to pull the information from the remote server, decode the JSON formatted information, save it to a local SQLite file then load from the SQLite file to the screen. Note that the database is persistent, so if you run it multiple times, the remote database call will continue to add new rows of data to the SQLite database.
For a full video explanation, check out the YouTube video (15 minutes in length):
[tubepress video =iIeJEBQYA10]