Ahmed Rajab
Ahmed Rajab

Reputation: 701

What should I do to make firebase database sync even if the app is not opened

I read about firebase database persistence but I am not sure if it is the right way to make my application sync data automatically while it is not opened like other apps like whats app and facebook do. Is it enough to make the persistence enabled and the app will sync automatically even if it is closed or after system reboot or should I should use sth else like services and broadcast recievers

Upvotes: 1

Views: 444

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317497

When talking about Realtime Database, persistence doesn't refer to automatic synchronization. It refers to local storage of data that has been previously synchronized, so that it can be used later while the app is offline.

Realtime Database will not do anything for your app when it's not open or running. If you want your Android app to do something when it's not actively being used, you will have to arrange for that yourself using tools such as JobScheduler and services. Then you can invoke Realtime Database to sync something as you wish.

Upvotes: 2

Related Questions