I have a web app that uses a Realtime Database to store data. If I go offline while the database is connected, make changes, and reconnect, everything works as intended. However, I'm trying to make my web app work as a PWA. Right now, the database only works offline if the page goes online while being used. If you close the app fully while offline and open the app, it won't load.
I see that Cloud Firestore for web has the enableIndexedDbPersistence()
method, which appears to do what I want, although obviously since it's for a different service I can't use it. I also see that Realtime Database for Android has FirebaseDatabase.getInstance().setPersistenceEnabled(true)
, but since its for Android I can't use it for a web app.
Is there a way to enable this functionality?
Firebase Realtime Database only supports disk persistence in its Android and iOS SDKs. There is no disk persistence in the JavaScript SDK for Firebase Realtime Database.
Also see: