peter
peter

Reputation: 13491

What to Use for PhoneGap Database Storage

I am writing an application using PhoneGap, and am finding it hard to work out how to store my data in a database. For the minute I just want to keep an open mind as I will be recommending technology options to our company.

The PhoneGap API for storage is here,

http://docs.phonegap.com/en/1.3.0/phonegap_storage_storage.md.html#Storage

It is based on this HTML5 spec,

http://www.w3.org/TR/webdatabase/

The problem for me is that the specification for this is not being maintained any more, and the standard has been deprecated.

The other problem is that I implemented a database using web database, and the versioning didn't work properly.

What is PhoneGaps stance on this and will PhoneGap look at other technologies such as the Indexed Database API,

http://www.w3.org/TR/IndexedDB/#database-concept

I am storing JSON data in the localStorage for now which is working great, but I am wondering if my database could get too big and it might not be the best option.

Upvotes: 23

Views: 14297

Answers (1)

dhaval
dhaval

Reputation: 7659

I faced the similar issue while developing an application few months back in which we were expecting to port the application to different platforms (with different versions). So instead of using the core storage mechanism which phonegap offers we went on using a dedicated storage framework which can provide consistent api but uses the best underlying storage mechanism.

There are variety of JS frameworks which can help you use the underlying storage. The following are few might interest you if you are planning to use the app on different platforms.

PersistenceJS - persistencejs.org

lawnchair - http://westcoastlogic.com/lawnchair/

persistencejs uses gears and localstorage in combination which helps to run the app on BlackBerry 5.x devices as well without any change.

I went on using the persistencejs and it have really worked well till now. We have ported the application on Android, iPhone, iPad, BlackBerry (5.x and greater)

Upvotes: 19

Related Questions