Android Live Firebase Offline Sync


Kevin Jensen

I'm not sure if this is what firebase is supposed to do, but when I use this line:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

Everything is great and I can use the app offline. But what I want to achieve is when the user adds something offline and closes the app. When the network connection is restored, the user doesn't have to open the app again, it should sync itself without opening the app. Is it possible?

Doug Stevenson

Enabling persistence will not force a sync anytime there is a network connection. Your application must be running in the foreground for the SDK to reconnect to the Realtime Database and synchronize any pending writes. There is nothing in the SDK that wakes your app to perform a sync when your app is not running. You can arrange it yourself if you want, but that's beyond the scope of this question.

Related


Android - Firestore Offline Data Sync

Leonardo Sibera The company's FireStore documentation says: Cloud Firestore caches the data your app is using, so the app can write, read, listen, and query data even when the device is offline. When the device comes back online , Cloud Firestore syncs all loc

Android - Firestore Offline Data Sync

Leonardo Sibera The company's FireStore documentation says: Cloud Firestore caches the data your app is using, so the app can write, read, listen, and query data even when the device is offline. When the device comes back online , Cloud Firestore syncs all loc

Can Firebase run 100% offline and sync later?

Jamey McElveen I need to build an app for task work that runs 100% offline and then syncs with the server when it reconnects to the internet. The app "currently" has more than 6,000 people in the database, which needs to be searched when missionaries are out i

Can Firebase run 100% offline and sync later?

Jamey McElveen I need to build an app for task work that runs 100% offline and then syncs with the server when it reconnects to the internet. The app "currently" has more than 6,000 people in the database, which needs to be searched when missionaries are out i

Can Firebase run 100% offline and sync later?

Jamey McElveen I need to build an app for task work that runs 100% offline and then syncs with the server when it reconnects to the internet. The app "currently" has more than 6,000 people in the database, which needs to be searched when missionaries are out i

How to sync Firebase offline data with online data

Marek Baláž When syncing offline data on Firebase, new online data on other devices will be deleted. I need to sync my offline data and keep new online data without deleting. Is it possible? Thanks for your answer. Frank Vampfelen If you have multiple users wr

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Firebase Android offline performance

Nils When storing around 5000 child nodes under a single node, Firebase is very slow to initialize when using the offline feature. It takes about 30 seconds to execute the first query. Once initialized, executing subsequent queries (such as listing the top 25

Android: Live Firebase Rules

mini I want to know how to protect my rules. I try to use auth.uid != nullin read and write . However, if a new user tries to log in or create a new account, it will not succeed and deny me permission. I want to protect the user and restrict reading only to th

Firebase Offline Storage Advanced - Manual Sync and Progress Info

tattered I have an app where one of the main features is "offline use". We generate an SQLite database on the server, which is made available on the API for download. Every time the database changes, the user has to re-download the full SQLite database (curren

Firebase SDK, offline data storage, and option to sync later

Ossio When using Firebase in an iOS app, I want to give users the option to sync their data into the Firebase cloud, or just keep everything locally. I've seen Firebase introduce the option in their SDK to take it offline and keep data out of sync online, but

Firebase won't sync offline cache if the app is killed

Crocodile I am setting up offline persistence FirebaseDatabase.getInstance().setPersistenceEnabled(true); As stated in the previous article , but the following use case fails: Turn off the internet connection on your phone try to write to the database Kill an

Does Firebase sync offline data after reconnect and logout?

Devaz I have an offline data loss situation, but it seems like it should have been synced to the server. Scenes: User is logged in to our Firebase app. Persistence is turned on, as suggested by Firebase: Database.database().isPersistenceEnabled = true If the

Firebase Offline Storage Advanced - Manual Sync and Progress Info

tattered I have an app where one of the main features is "offline use". We generate an SQLite database on the server, which is made available on the API for download. Every time the database changes, the user has to re-download the full SQLite database (curren

Firebase SDK, offline data storage, and option to sync later

Ossio When using Firebase in an iOS app, I want to give users the option to sync their data into the Firebase cloud, or just keep everything locally. I've seen Firebase introduce the option in their SDK to take it offline and keep data out of sync online, but

Firebase won't sync offline cache if the app is killed

Crocodile I am setting up offline persistence FirebaseDatabase.getInstance().setPersistenceEnabled(true); As stated in the previous article , but the following use case fails: Turn off the internet connection on your phone try to write to the database Kill an

Firebase won't sync offline cache if the app is killed

Crocodile I am setting up offline persistence FirebaseDatabase.getInstance().setPersistenceEnabled(true); As stated in the previous article , but the following use case fails: Turn off the internet connection on your phone try to write to the database Kill an

Does Firebase sync offline data after reconnect and logout?

Devaz I have an offline data loss situation, but it seems like it should have been synced to the server. Scenes: User is logged in to our Firebase app. Persistence is turned on, as suggested by Firebase: Database.database().isPersistenceEnabled = true If the

Firebase SDK, offline data storage, and option to sync later

Ossio When using Firebase in an iOS app, I want to give users the option to sync their data into the Firebase cloud, or just keep everything locally. I've seen Firebase introduce the option in their SDK to take it offline and keep data out of sync online, but

Firebase Offline Storage Advanced - Manual Sync and Progress Info

tattered I have an app where one of the main features is "offline use". We generate an SQLite database on the server, which is made available on the API for download. Every time the database changes, the user has to re-download the full SQLite database (curren

Firebase won't sync offline cache if the app is killed

Crocodile I am setting up offline persistence FirebaseDatabase.getInstance().setPersistenceEnabled(true); As stated in the previous article , but the following use case fails: Turn off the internet connection on your phone try to write to the database Kill an

Firebase won't sync offline cache if the app is killed

Crocodile I am setting up offline persistence FirebaseDatabase.getInstance().setPersistenceEnabled(true); As stated in the previous article , but the following use case fails: Turn off the internet connection on your phone try to write to the database Kill an

Does Firebase sync offline data after reconnect and logout?

Devaz I have an offline data loss situation, but it seems like it should have been synced to the server. Scenes: User is logged in to our Firebase app. Persistence is turned on, as suggested by Firebase: Database.database().isPersistenceEnabled = true If the