Android Firebase query on multiple keys

475 views
Skip to first unread message

Brendan

unread,
Nov 3, 2016, 9:56:56 AM11/3/16
to Firebase Google Group
Hello,

I'm coding with Firebase in an Android app. My firebase structure is as follows:

{
  "example": {
    "A": {
       "data": true
    },
    "B": {
       "data": true
    },
    "C": {
       "data": true
    }
  }
}

If I want to query on B and C, do I need to run two separate "addListenerForSingleValueEvent" for both B and C? Or is there a way to add B and C to one query? My app has a list of up to 60 results to check against the example node so I'm not sure if running 60 separate single value event listeners is efficient.

Thank you

Kato Richardson

unread,
Nov 3, 2016, 2:06:11 PM11/3/16
to Firebase Google Group
Hi Brendan,

Multiple listeners are fine. If B and C share some common criterium, you can create a query to listen on items that match that. But you can't create one listener that listens at two unrelated places; if you think this through, it's by definition, two listeners unless they have some common thread.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/a6f0ec56-b45c-45ac-96a0-26d96e23f08d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages