Reputation: 25
I want to retrieve the value from Firebase database without adding or updating any value.
I tried using every listener, but they all need data to be updated for retrieving values.
Upvotes: 1
Views: 2317
Reputation: 942
If it can help//
My solution about this is to unregistered the Firebase listener and then register it again.
Upvotes: 0
Reputation: 598728
When you attach a Firebase listener it immediately values for the existing value and then fires again for any changes. So you don't need to change the value to have the listener fire.
From the documentation:
You can use the
onDataChange()
method to read a static snapshot of the contents at a given path, as they existed at the time of the event. This method is triggered once when the listener is attached and again every time the data, including children, changes.
Upvotes: 4