inblueswithu
inblueswithu

Reputation: 963

PouchDB + SQLite plugin for Cordova/PhoneGap

I'm trying to create a web application as well as mobile application (using PhoneGap). I'm using HTML5/CSS/JS as I have to be compatible with PhoneGap. I need my mobile app to be available & work offline as well (I should be able to at least push data to database, not much concerned about retrieving it, its ok to restrict the user to go online for fetching the data). I know its kind of weird but this is what my requirement is.

I landed onto PouchDB somehow. And it seems to work as intended for me using SQLite plugin while compiling PhoneGap app. As discussed in here: http://pouchdb.com/adapters.html (SQLite plugin for Cordova/PhoneGap) - I understood that it can work offline seamlessly and sync with PhouchDB when online without any developer intervention in this.

I don't want to waste my time again just blindly going with PouchDB. I would like to confirm its capabilities even before exploring it.

  1. Is my assumption correct regarding PouchDB?
  2. Does this seamlessly communicate between local & online db servers?
  3. Are there any other better alternatives than this for me?

Note: My data will be mostly normal text along with a single Image each time while writing to DB. (I need to store Pictures as well - somewhere, should be easy with online & offline too - Any suggestions here is gladly welcome)

Thanks & Regards,

inblueswithu

Upvotes: 3

Views: 2817

Answers (2)

leo
leo

Reputation: 1275

I believe that Firebase has local (offline) persistence capabilities but only when you use the native Android or iOS SDKs, apparently it's not there in the Javascript SDK yet.

For my app this doesn't really matter because I think my app is pretty useless without a network connection anyway. So why bother adding more complexity to make it work 'offline'.

However if you do want offline capabilities then apart from the PouchDB/CouchDB combo (which I've heard about also) an interesting option might be Meteor (to be precise the angular-meteor project):

http://angular-meteor.com/

Apparently this gives you the same 'real-time' capabilities as Firebase:

www.codementor.io/meteor/tutorial/why-you-should-use-angular-meteor-library

And apparently you can make it work "offline" as well:

http://rafaelquintanilha.com/offline-app-with-meteor-and-cordova/

Upvotes: 1

CorbinUX
CorbinUX

Reputation: 586

I found this post about 10 months because I, like OP, started with Firebase and wanted something offline. I've now been coding with PouchDB, CouchDB on Ionic / Cordova and it's 100% what you're dreaming about.

PouchDB is "just" a CouchDB API for most storage engines available (WebSql, Sqlite, IndexedDB, Level, etc). Best of all the API also supports syncing with other CouchDBs.

The biggest thing is learning how to leverage CouchDB's _id's for all they are worth.

Upvotes: 5

Related Questions