Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phonegap - sqlite or Indexed DB?

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.

like image 868
Iwona Trąbka Avatar asked Jan 31 '13 11:01

Iwona Trąbka


2 Answers

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

like image 167
Sergei Grebnov Avatar answered Sep 19 '22 16:09

Sergei Grebnov


Latest Update (May 05, 2014): New Cross Platform Cordova WebSQL plugin by MS Open Tech

Microsoft Open Technologies is publishing the new open source WebSQL plugin for Apache Cordova and PhoneGap. This plugin allows developers to integrate a persistent SQL-based local storage solution in their Cordova apps using the exact same JavaScript code across Android, iOS, Windows Phone and Windows Store.

like image 37
Vinayak Bevinakatti Avatar answered Sep 21 '22 16:09

Vinayak Bevinakatti