Clearing the android back stack will clear the firestore cache?

Viewed 44

I have a fairly complex app, I want to optimise the firestore fetch for performance and lower reads.

In Activity1, I get the firestore data. And when I click the back button, I clear the back stack.

So when I open that Activity1 again, will the firestore cache work? Or will it fetch making it a new read?

I wanted to know before coding it, saves time.

1 Answers

The Firestore cache does nothing to optimize the cost or performance of queries by default. Its primary use case is for making queries possible while the app is offline.

If you want to explicitly use the cache, you will have to call that out in your query, using a source option, as described in the documentation.

For more detailed information about how the Firestore persistence layer works, read this.

Android activity lifecycle has no impact on the way Firestore queries work

Related