Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 tried using Firebase and in the middle of the development I understood that its not truly persistent! It just can handle network outages etc., but does not persist data at all between PhoneGap App sessions. [With my understanding even with AngularFire this is not possible]

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

like image 492
inblueswithu Avatar asked Aug 24 '26 17:08

inblueswithu


1 Answers

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.

like image 190
CorbinUX Avatar answered Aug 28 '26 04:08

CorbinUX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!