I apologize if this is a dumb question, but is Firebase's android sdk already asynchronous? I've used RxJava in previous projects and have found instances of people using it in conjunction with the Firebase sdk. Why would this be necessary if the sdk is already async? Thanks.
Asked
Active
Viewed 125 times
0
-
Firebase has well over a dozen SDKs, so it's hard to give a specific answer without knowing which one you are asking about. But that said: all of these SDKs interact with Firebase's serves in some way, and such interactions are asynchronous (to ensure that they don't block the user from interaction with your app). – Frank van Puffelen Oct 29 '17 at 07:15
1 Answers
1
I will assume, that you mean Firebase Realtime Database.
For this applies, that all of the reading and writing to the database is asynchronous.
All the read from network / disk cache is done off the main thread and all your callbacks will be called on main thread.
People may use it with RxJava because of convenience of chaining more calls together or combining it with other services (like load from REST + observe all items from firebase).
You may read more info here:
https://firebase.google.com/docs/database/android/read-and-write (says it's asynchronous)
other SO post Do we need to use background thread for retrieving data using firebase?

mlykotom
- 4,850
- 1
- 22
- 27