Ujjwal Kumar Maharana
Ujjwal Kumar Maharana

Reputation: 279

Offline persistance with cloud firestore in Android

I am using google cloud firestore to store data. There is an option to enable offline persistance. My requirement is to have offline support & also that data should be shown after kill & launch of app.
My Queries:

  1. Can I use only cloud firestore & have pure offline support. [Lets say user entered some data, I push it to cloud firestore & then user kills & launches the app again this time without internet, so can that data be made available directly by cloud firestore or do I need some kind of room implementation]
  2. I have set setPersistenceEnabled as true in firestore settings. Suppose user inserts something, which I try to push it to google firebase. But that time internet is not available & then user kills the app. When user again opens the app & internet is available so will that sync be automatically made just by cloud firestore or here again I need to apply some logic & persist data using room & push to firestore manually

Link for cloud firestore offline support documentation https://firebase.google.com/docs/firestore/manage-data/enable-offline

Upvotes: 0

Views: 46

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317497

  1. Yes, that's how it works. Data written while offline is persistent on the device. That's why it's called "offline persistence".

  2. Yes, that's how it works. It will retry all writes until fully synchronized.

These are things you should be able to try on your own fairly easily.

Upvotes: 0

Related Questions