Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase high background data usage on android

I am using firebase for a school dashboard application. The application is built using android. It logs in via google credentials to firebase. Disk persistence is enabled on firebase. There are no other services or connections that the app uses. Firebase version set in build is 'com.firebase:firebase-client-android:2.4.0+'

I opened the app - it logs in and gets the data - then put it in background. The data usage looks like the following -

Foreground data usage stays steady at - 38.87kb

Background data usage keeps increasing every few minutes - 2.53kb, 2.94kb, 11.49kb, 11.9kb, 12.18kb, 12.59kb, 13.90kb, 67kb, 92kb. It is consuming about 1.5kb of data every minute.

I've made sure all firebase listeners are disconnected on pause. Why is the application background data usage continuously increasing over time?

like image 339
anar Avatar asked May 06 '26 17:05

anar


1 Answers

The Firebase client keeps a network connection open to its servers. As part of keeping this connection, the client and server occasionally exchange keep-alive messages. These will likely use some memory, which should be (largely) reclaimed upon a garbage collection.

You might want to upgrade to the latest version of the Firebase SDK for Android btw. It's now on version 2.5.2.

like image 92
Frank van Puffelen Avatar answered May 09 '26 07:05

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!