0

I'm making use of both firebase authentication and firebase real time database in my android app. I currently run all functions firebase provides on the main-thread, is this wrong or not? Because i can't find any information in the firebase documentation that any of the funtions is long-running operations (and long-running operations should not be run on the main-thread).

Is any of the firebase function long-running oprations? If so, where can i find which functions is long-running operations, because i can't find that information in their documentation?

eek
  • 57
  • 2
  • 7
  • Any network and disk operations that the Firebase SDK needs are done on a separate thread. Any callbacks to your code however are then surfaced on the main thread. This means that in most cases you don't need to worry about anything. Only if you do significant work in `onDataChange` or `onChild...` methods, will you have to move that work to a background thread. But you'll find clear logging in the logcat output when that is needed. See my answer here: https://stackoverflow.com/a/39060380 – Frank van Puffelen Mar 20 '20 at 14:37

1 Answers1

0

The Firebase Database client performs all networking, disk I/O and other maintenance on a separate thread. It then surfaces the callbacks to your code on the main thread, so that you can interact with the UI.

Please refer to this beautiful answer by Frank van Puffelen.

Vishist Varugeese
  • 1,500
  • 1
  • 17
  • 30