简体   繁体   中英

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

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM