13
votes

I am developing a mobile app for Android and iOS using jQuery Mobile. The app will be deployed to Android and iOS devices utilizing Phonegap.

My problem is that I need a local offline data storage mostly for read operations.

I am planning to pull a data set from a web server (MySQL/web service) about once a month (whenever there is new data) and store it for local use on the device.

Now the question, what persistence solution should I use?

There is a tool called lawnchair by a member of the Phonegap team. Anyone tried it? What are the pros and cons? http://westcoastlogic.com/lawnchair/

What about sqlite? Is it working across Android and iOS devices?

THX

3

3 Answers

10
votes

You could simply use HTML5 Storage / SQL Lite for this. Take a look at: http://diveintohtml5.ep.io/storage.html

I`ve been using Localstorage on iOs and Android without any problems, and since localstorage is backed up by sqllite i think you should be fine. (but i canĀ“t say anything for sure for sqllite on android)

0
votes

HTML5 storage works fine on Android. A nice tool to make reading and writing to the database easier is persistenceJS.

I've just started on setting up the iPhone version of my jQueryMobile / Phonegap app. It stalls right at the point where the first call to localdb is made. This may be a problem of the iOS simulator, since the regular Safari runs my app just fine from the browser.

0
votes

The HTML5 LocalStorage option will works fine until iOS 5.0. But there might be some problems from iOS 5.1 and later.

So my suggestion is to write some javascript code to back up to the document folder via fileAPI, and reconstruct the WebSQL database periodically.