Reputation: 462
How to get a constant value from firebase?
I'm maintaining a global count variable of number of friends a user has. Everytime user wants to add friends I need to increment that variable. How can I achieve this.
If I use a OnDataChangeListener() I will be able to read the DataSnapShot only when there is some change in data. But I want to read the data even when some part of the data has not changed.
Upvotes: 2
Views: 789
Reputation: 8254
OnDataChangeListener
will be triggered one time when you add the listener.
So you don't need to wait until data changes, try using it.
Upvotes: 3