Cordova – Phonegap Sqlite, WebStorage, LocalStorage. Which one

cordova

I am investigating converting a mysql database over into a phonegap app.

Now with HTML5 there is a specification for Web Storage (Is it commonly called local storage?)
This is what I believe Phonegap uses via it's storage method/api. Which would be key value string pairs correct?

But I am reading up on this tutorial and it keeps mentioning Phonegap and Sqlite as a built in api. It is using proper SQL syntax.

Which is used natively?

Sorry if this is very confusing to read, it is very confusing for me to get my head round.

Best Answer

As per phonegap documentation:

This API is based on the W3C Web SQL Database Specification and W3C Web Storage API Specification. Some devices already provide an implementation of this spec. For those devices, the built-in support is used instead of replacing it with Cordova's implementation. For devices that don't have storage support, Cordova's implementation should be compatible with the W3C specification.

Phonegap allows hooks so that you can access the various storage options on the device. As far I understand, the term localstorage object is an HTML feature where a web browser stores information and this is a bad option for storing data as I have seen this gets cleared every time you launch your application again.

On the other hand if you use the database object it is saved even after you launch the application again.

Local Storage http://diveintohtml5.info/storage.html

Phonegap http://docs.phonegap.com/en/2.3.0/cordova_storage_storage.md.html

Related Topic