Android Firebase, simply get one child object's data -


i have been looking way 1 child object's data in android firebase.

i have found things firebase retrieve child android. solutions suggesting using "childeventlistener", need data @ moment, not when moved, deleted, updated, etcetera.

my data kept in https://.firebaseio.com/users//creation string. figure there must simple way access without needing much, because if copy exact url browser, can see the: 'creation: "2015/05/31 21:33:55"' right there in "firebase forge dashboard".

if knows how access without listener change appreciated!

thank you!

firebase listeners fire both initial data , changes.

if you're looking synchronize data in collection, use childeventlistener. if you're looking synchronize single object, use valueeventlistener. note in both cases you're not "getting" data. you're synchronizing it, means callback may invoked multiple times: initial data , whenever data gets updated.

this covered in firebase's quickstart guide android. relevant code , quote:

firebaseref.child("message").addvalueeventlistener(new valueeventlistener() {   @override   public void ondatachange(datasnapshot snapshot) {     system.out.println(snapshot.getvalue());  //prints "do have data? you'll love firebase."   }   @override   public void oncancelled(databaseerror databaseerror) {           } }); 

in example above, value event fire once initial state of data, , again every time value of data changes.

please spend few moments go through quick start. shouldn't take more 15 minutes , save lot of head scratching , questions. firebase android guide next destination, question specifically: https://firebase.google.com/docs/database/android/read-and-write


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -