I am trying out Firebase Realtime Database. I have a created a node users
, In that I have created a node user_1
. The JSON is like the one below
{
"user_1" : {
"firstName" : "User",
"lastName" : "Last",
"middleName" : "S"
}
}
I have enabled Offline Persistence & the Sync enabled for that particular Node user_1
.
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
FirebaseDatabase.getInstance().getReference().child("users").child("user_1").keepSynced(true);
Firstly , I opened the App & synched the user_1
data. Then I killed the Application, But the Device is still connected to internet. I made changes to the user_1
node in the Firebase Console. After sometime , I have disconnected to internet. I opened the app again, listened to that node user_1
. But the offline data is not synced with the latest data from Firebase Server. Does that mean , keepSynced()
will only work when the Application is in Foreground ?