Nick Bolles
Nick Bolles

Reputation: 439

Phonegap DB options, IndexedDB, SQLite?

I am building a Phonegap App and need to store data in a database. I would like to be able to access this information offline, but sync it to the server too. I want this app to work across all platforms if possible. I know that there are a ton of posts out there with similar questions but I cant find any that are relatively recent.

I have done a ton of research on it but it has only confused me more. I know IndexedDB is available on all browsers except IOS Safari now (but will be in IOS 8 http://caniuse.com/indexeddb and my app wont be completed till then probably) But I've heard that webSQL(SQLite) is better, but is of course depreciated.

Should I go with SQLite like Samuel's comment here? He has a syncing plugin for it too. SQLite database on PhoneGap / iOS - More than 5mb possible

Or with a Polyfill for IndexedDB as explained here? http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html

I also just came accross this library, has anyone used it? It looks promising... http://pouchdb.com/learn.html

Or something completely different?

Also are there any plugins for syncing to a server?

Thank you in advanced for any responses

Upvotes: 1

Views: 594

Answers (3)

Nick Bolles
Nick Bolles

Reputation: 439

I Ended up going with LocalStorage. It has good support and is easy to use. Also I am using MongoDB on the backend, so everything from front to back stays as javascript/JSON

http://caniuse.com/#feat=namevalue-storage

Upvotes: 0

Masood Moshref
Masood Moshref

Reputation: 380

in case of developing for many devices and platforms. You must clear which technologie have the best support and which is future-proof.

IndexedDB was the best way! because it is future-proof. Actually the Cordova / Phonegap project use for iOS the older WebView and not the wkwebview! therefor the have only a readable indexeddb and you must use the pollyfil solution. But its a matter of time, when the solve the problem.

In other platform (Android/Win8 etc. ) the supports nativly indexeddb. And it is very fast, if you know how tu use.

Upvotes: 0

AtanuCSE
AtanuCSE

Reputation: 8940

I wonder if anyone will answer this with certainty, I would also like to know that answer. Till now I would suggest the SQLite wrappers. That samuel answer looks very promising.

Or you can use sqlite/websql and write the sync code by yourself using php or asp script.

Upvotes: 1

Related Questions