I played with Firebase, deleting and adding users.
Then I decided to delete all of my users, and now I can still access nodes that no longer exist.
The following shows how I retrieve dataSnapshot and print from the most recent Firebase database.
mFirebaseUsersRef = new Firebase(Constants.FIREBASE_URL_USERS).child(mLoggedUser.getEmail());
mFirebaseUsersRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()) {
mLoggedUser = dataSnapshot.child(mLoggedUser.getEmail()).getValue(User.class);
Image of the Firebase database
Please note that there is only one user in the user list, however, if my mFirebaseUsersRef abstracts the email with node before deleting all my users in my Firebase database, but currently it is not, dataSnapshot will retrieve all the data that existed before removing the node.
I hope I made it clear that I would be happy to answer any doubts about my question.
Below is a listing of nonexistent data that my dataSnapshot retrieves.
Phantom data
EDIT
After debugging each line, I noticed something strange: first the DataSnapshot exists, as shown here: Phantom data , but after going through all if (even throughstartActivity(i);) it goes back to if(dataSnapshot.exists()) {and shows that dataSnapshot is now null: Now node is null
source
share