Kartik Ohri Kartik Ohri - 1 year ago 70
Android Question

Retrieving data from firebase database in android

I'm recently migrated to Firebase. I have gone through Firebase Android api docs for retrieving data from database through JSON. there is method

onDataChange(DataSnapshot snapshot)
to retrieve data whenever there is change in data in database but I could find how to retrieve data even if there is no change in database.

For example:- when a user logs into my app, I want that data which is stored under the unique id node should be retrieved. How can I retrieve data anytime from Firebase database if i want?

Answer Source

From the Firebase guide on reading data:

[the onDataChange() method is] triggered once with the initial data and again every time the data changes.

I highly recommend that you read the Firebase guide for Android programming end-to-end. It'll answer many of the questions you're likely to have as you start using Firebase.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download