Has anybody implemented a native app with Firebase with full offline capabilities in Android/iOS?
Could this be done in Cordova/Ionic with a plugin that uses the native Firebase SDKs?
We are building an app that has connection at download and first start but then we have to assume there is no more internet connection for a while and all content from the database has to be available offline. Is Firebase suitable for this requirement or do we have to use CouchDB/PouchDB or any other alternative?
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.