This is my data on Firebase-
app-<br />
-Users<br />
+366MWex62IhUaOwbkjjGedIgLQJ3<br />
-sfsfaegaergg<br />
firstname: "John"<br />
lastname: "Doe"<br />
phone: "+1123456789"<br />
There are two users in my db for now. My input is phone = "+1123456789" (2nd user)<br />
This is my code-
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference rf = rootRef.child("Users"); com.google.firebase.database.Query query = rf.orderByChild("phone").equalTo("+1123456789"); query.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for(DataSnapshot snap: dataSnapshot.getChildren()) { Log.v("children", snap.getChildren().toString()); } } @Override public void onCancelled(DatabaseError databaseError) { } });
I am not getting the details of the second user. The debugger goes till addValueListener and then directly exits. Where do I need to make corrections? Thank you.
onDataChange
? – John O'Reilly