firebase Listener not getting triggered once for the initial state

318 views
Skip to first unread message

Tenzin la

unread,
Sep 27, 2015, 1:38:45 PM9/27/15
to Firebase Google Group
i have implemented the firebase to read data from the url , it does't trigger the listener for initial state but it works only when i add value to JSON tree .. please help...
here is code snippet..



mFirebaseRef.child("article").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
for (DataSnapshot postSnapshot : snapshot.getChildren()) {

Article article = postSnapshot.getValue(Article.class);
articles.add(article);
}
}

@Override
public void onCancelled(FirebaseError firebaseError) {
Toast.makeText(context, "Floor update canceled: " + firebaseError.getMessage(),Toast.LENGTH_SHORT).show();

}
});

Jacob Wenger

unread,
Sep 28, 2015, 1:41:26 PM9/28/15
to fireba...@googlegroups.com
Hey there,

That's odd. It definitely should be firing for the initial data. How have you confirmed it is not firing? Have you added a log statement to see if it is hit? Are you getting any error messages? Also, what version of the Java library are you using? Once we have more details, we can hopefully track down where things are going wrong.

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/21372d45-69a9-4ef8-a352-9add54f68e13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages