While using firebase with disk persistence enabled in android, I observed sometimes the data added using setValue() method is not reflected in the database.The code is just simple firebaseRef.child("xyz").setValue(userObj).Any ideas?
Your updated question from the comments is:
how can I know if the value has been written to the database for sure?
For this you add a completion listener to the setValue() call. From the documentation on completion listeners:
ref.setValue("I'm writing data", new Firebase.CompletionListener() {
@Override
public void onComplete(FirebaseError firebaseError, Firebase firebase) {
if (firebaseError != null) {
System.out.println("Data could not be saved. " + firebaseError.getMessage());
} else {
System.out.println("Data saved successfully.");
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With