What is the difference between ChildEventListener and ValueEventListener Firebase interfaces?

后端 未结 3 710
悲&欢浪女
悲&欢浪女 2021-01-01 18:22

The documentation says they both listen to changes at a Firebase database location.

3条回答
  •  星月不相逢
    2021-01-01 18:57

    ValueEventListener gets fired only when that specific value changes, but ChildEventListener listens not only value of that node, but also for all child nodes of tree. Say, you have node, which has one children. ValueEventListener will be triggered when this node changes, but ChildEventListener will also be triggered whenewer child values is changed as well. Documentation says, that you should use ChildEventListener with caution - it can be triggered a lot of times.

提交回复
热议问题