Two applications use the same firebase database. One application, i.e. A writes some value using setValue . 2nd application, i.e. B tries to read some data using addListenerForSingleValueEvent , which has the value A , such as A . in the same time. This results in a datasnapshot value of zero in Appendix B when reading the database. Can anyone guide me, how can I avoid this situation.
Just for some cleaning up, A writes to some other node from the one that B is accessing .
Here is how I can access the data from the application Bed and .
DatabaseReference usersRef = MyDatabaseUtils.getUsersReference();
usersRef.orderByChild("userId").equalTo(userIdValue).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.getChildrenCount() > 0) {
} else {
}
}
@Override
public void onCancelled(final DatabaseError databaseError) {
}
});
Everything works fine, if I stop writing A in the reading time in the annex Bed and .
source
share