Firebase’s battery life features as a cache

I am wondering if a reasonable strategy is to use the autonomous capabilities of firebase as a "free" cache.

Suppose I am in activity A, I take some data from firebase, and then move on to activity B, which needs the same data. If the application is configured with setPersistenceEnabled (true) and, if necessary, also with keepSynced (true), can I just re-request the same data in activity B and not pass it?

I understand that there is a difference between the two approaches to reading from memory and reading from disk (firebase offline cache). But am I really getting rid of all network overhead by using firebase offline?

Relevant Links:
Offline features of Firebase and addListenerForSingleValueEvent https://groups.google.com/forum/#!msg/firebase-talk/ptTtEyBDKls/XbNKD_K8CQAJ

+5
source share
1 answer

Yes, you can easily query your Firebase database in every action, rather than transferring data. If you turn on the hardness of the disk, it will be a local read operation. But since you are connecting a listener (or supporting it with keepSynced() ), this will lead to network traffic.

But do not use Firebase as a standalone database. It is truly designed as an online database that can run from short to intermittent shutdown periods. In offline mode, it will support a write queue. As this queue grows, local operations and application startup slow down. Nothing serious, but it can add up over time.

+6
source

All Articles