Skip to content Skip to sidebar Skip to footer

Do I Need Background Thread And Loader For Retrieving Data From Firebase?

I'm just retrieving data from Firebase, not working with any API so I didn't create background thread to perform background work or use loaders to load data. Is it okay to be like

Solution 1:

Firebase SDKs already perform all network and disk I/O off the main thread, and then call your code on the main thread so you can update the UI. This means that in most cases you don't have to put the code that uses the Firebase SDK in a background thread.

So while there may be cases where you need to do extra work, I'd start with simply putting the relevant code in the activity (or other regular object) and only look into moving it into a background thread if you encounter problems.


Post a Comment for "Do I Need Background Thread And Loader For Retrieving Data From Firebase?"