We're developing a mobile app (Android and iOS for now) for which we're using Firebase for chat and other real-time messages.
The structure we're using is:
firebase-url/user-id/
contacts/child-element
activities/
joined/child-element
created/child-element
notifications/child-element
In order to keep my app data updated I execute a query and attach a child listener to each first level child(or second in the case of activities) of the user-id branch (contacts, joined, created, notifications). Functional wise it works perfectly and can easily keep everything up to date, but had a one hour user test today and the battery drain was pretty heavy (for one user the app was using around 26% of the battery, second most used) and always the GC collector runs quite often, my feeling is that the firebase connection might be the biggest user. Is this correct? Might it be better to have a child listener only on the user-id branch?
Any help would be appreciated. I will post some of the Android code if needed.
PS: This was for the Android version of the app.