虽然在android中启用了启用磁盘持久性的firebase,但我观察到有时使用setValue()方法添加的数据没有反映在数据库中。代码只是简单的firebaseRef.child(“xyz”)。setValue(userObj)。任何想法?
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.");
}
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.