aez
aez

Reputation: 2396

Firebase Realtime Database persistance clarification needed

For an Android client with Firebase Realtime Database persistence enabled, is it true that there will be no Firebase downloads each time I close and re-open the app, assuming there have been no changes to the database?

Furthermore, with persistence enabled, each time an app is re-opened, is it true that Firebase will only download the changes?

Upvotes: 0

Views: 845

Answers (1)

RamithDR
RamithDR

Reputation: 2213

Yes to both, if I may quote the documentation :

By enabling persistence, any data that we sync while online will be persisted to disk and available offline, even when we restart the app. This means our app will work as it would online using the local data stored in the cache. Listener callbacks will continue to fire for local updates.

Enabling Offline Capabilities on Android

It's just amazing you could do this with one line of code, and I've been integrating offline capabilities to all the projects I've been developing lately, it works like a charm and less headache for us developers.

EDIT:

Provided that disk persistence is enabled and it isn't the first launch of the app, I can confirm that Firebase does not re-download the whole database again. When I was first implementing the persistence storage.I was monitoring the network usage of my app using Android studio, in first launch I could see a considerable usage of network resources, then I restarted the app and there was no activity in the network usage monitor.

Then I added few Strings to the database via Firebase console and monitored the usage when I restart the app and I could see a small network usage in the monitor, which I would define as just downloading the changes I did to my database and my app was synced with the changes instantly.

Upvotes: 3

Related Questions