Himanshu Chaudhary
Himanshu Chaudhary

Reputation: 25

Is there any way to retrieve data in Firebase without updating the values in database?

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

Answers (2)

Gomez NL
Gomez NL

Reputation: 942

If it can help//

My solution about this is to unregistered the Firebase listener and then register it again.

Upvotes: 0

Frank van Puffelen
Frank van Puffelen

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

Related Questions