Firebase offline capabilities in ionic / cordova

You can use the following project - AngularFire2-offline

It's purpose is to enable offline data access for supporting browsers (that supports service workers) - List of browsers (and matching versions) that support service workers

It works this way -

  • While online, Firebase data is stored locally (as data changes the local store is updated)
  • While offline, local data is served if available, and writes are stored locally
  • On reconnect, app updates with new Firebase data, and writes are sent to Firebase
  • Even while online, local data is used first when available which results in a faster load

There is no real "offline" support for firebase in their JS SDK. The offline solution they have right now means you will have offline support if you lose internet connection and if the connection goes "online" data will sync back. BUT if you close the app before going online again your "offline" data is lost.

The is a Cordova firebase plugin https://www.npmjs.com/package/cordova-plugin-firebase but it does not support the realtime database yet. you can try and extend this if you want.

if you must have an offline support i suggest you either use SQLite or CouchDB/PouchDB that you mentioned.