PouchDB + SQLite plugin for Cordova / PhoneGap

I am trying to create a web app as well as a mobile app (using PhoneGap ). I am using HTML5 / CSS / JS as I need to be PhoneGap compatible. I need my mobile app to be available and work offline (I should be able to at least push the data into the database without worrying about restoring it, okay to prevent the user from going online to get the data) ... I know this is strange, but this is my requirement.

  • I tried using Firebase and in the middle of development I realized that its actually not persistent! It just might work with network outages, etc., but doesn't store data at all between PhoneGap app sessions. [With my understanding, even with AngularFire this is not possible)

I landed on PouchDB somehow . And it seems to work as intended for me using the SQLite plugin while compiling the PhoneGap app. As discussed here: http://pouchdb.com/adapters.html (SQLite plugin for Cordova / PhoneGap) - I figured it could work offline without issue and sync with PhouchDB when online without developer involvement.

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

  • Is my assumption correct regarding PouchDB?
  • Does this support interoperability between local and online db servers?
  • Are there any other alternatives than this for me?

Note . My data will be mostly plain text along with one image each time it is written to the DB. (I also need to store Pictures - somewhere, should be easy with online and offline) - Any suggestions here are more than welcome)

Thanks and regards,

inblueswithu

+3


source to share


2 answers


I found this post for about 10 months because I, like the OP, started with Firebase and wanted something online. I have now coded PouchDB, CouchDB on Ionic / Cordova and this is 100% what you dream of.

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



The most important thing is to learn how to use the CouchDB _id for everyone they are worth.

+5


source


I believe Firebase has local (offline) save capabilities, but only when you are using native Android or iOS SDKs, apparently it doesn't exist in the Javascript SDK yet.

For my application, it doesn't really matter because I think my application is useless anyway without a network connection. So why bother with adding extra complexity to make it work "offline".

However, if you need standalone capabilities, then in addition to the PouchDB / CouchDB combine (which I also heard about), an interesting option might be Meteor (more precisely, 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 too:

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

+1


source







All Articles