phonegap - sqlite or Indexed DB?

Iwona Trąbka picture Iwona Trąbka · Jan 31, 2013 · Viewed 15.1k times · Source

I am web developer starting with phonegap. I need to create one app for iPhone, android and Windows Phone 8.
I need to store some data (too big for localStorage) locally.
I don't know witch solution is the best:

  1. Phonegap provides Storage (based on WebSQL - which is deprecated), but it is not supported by windows phone. Is there any plugin to fill this gap?
  2. I read about Indexed DB, but I haven't used it before and it is not very intuitive for me. I am not sure if it is fully supported in all platforms? I based on (http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html)
  3. Or maybe I can use phonegap plugins https://github.com/marcucio/Cordova-WP-SqlitePlugin for windows phone and https://github.com/marcucio/Cordova-SQLitePlugin for android and iphone.. Then my code would be the same in all platforms as I suppose.

Did someone create such an app before? I would be greatful for any solutions or ideas.

Answer

Sergei Grebnov picture Sergei Grebnov · Jan 31, 2013

Cordova WP8 supports IndexedDB only. iOS and Android WebSql only. Since WebSql is deprecated (I know how many people love/use it and agree that in many situations WebSql is very cool) I would recommend to proceed with IndexedDb and use the following polyfill for Android/iOS.

PhoneGap polyfill for IndexedDB that makes the IndexedDB API to work with WebSQL

Example