Reputation: 75
After doing some research it is still not clear to me how exactly Android downloads data from Firebase. Android has a lot of best practices for performance such as using an AsyncTask or Volley, but I need to understand how Firebase operates before I can make decisions about them.
To be more specific, does Firebase load data in a separate thread? When I am downloading profiles (a profile picture with some text) in a FirebaseRecyclerAdapter I would like to download the text for each profile first and the pictures in a separate thread. I know how to do this when downloading data from the internet normally but I do not know what Firebase already does.
Upvotes: 0
Views: 957
Reputation: 598797
Firebase uses a single separate thread for all its (network, disk, etc) operations. But your callbacks will always be invoked on the main thread, so that you can safely interact with the UI.
But if you perform any non-trivial operations in the callback, it is (as usual) your job to perform those operations off the main thread. So a AsyncTask
or IntentService
are still the proper approach there.
Upvotes: 1