Firebase offline capabilities in ionic / cordova

前端 未结 2 608
遇见更好的自我
遇见更好的自我 2021-01-04 20:00

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 na

相关标签:
2条回答
  • 2021-01-04 20:27

    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.

    0 讨论(0)
  • 2021-01-04 20:37

    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
    0 讨论(0)
提交回复
热议问题