Reputation: 148
I am working on an Android application that adds data to a Firestore server and I have encountered a problem. When my device is offline, the is not adding to Firestore, logically, but when the device is back online again, all of the data is somehow cached and added to Firestore.
This gives me data inconsistency problems, so is there a way to disable this behavior?
Upvotes: 0
Views: 238
Reputation: 317467
What you're describing is the expected behavior.
If you don't want this to happen, you should disable persistence as described in the documentation. Be aware that you will also be disabling the read cache as well. There is no way to disable the write cache without also disabling the read cache.
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
.setPersistenceEnabled(true)
.build();
db.setFirestoreSettings(settings);
Upvotes: 1