Do we need to use background thread for retrieving data using firebase?

前端 未结 3 500
生来不讨喜
生来不讨喜 2020-12-06 05:29

I\'ve an android app where I\'m retrieving data into a Fragment. And I believe that Firebase manages its asynchronous calls. But still I\'ve doubt the if we need to write th

3条回答
  •  [愿得一人]
    2020-12-06 05:49

    The Firebase Database client performs all network and disk operations off the main thread.

    The Firebase Database client invokes all callbacks to your code on the main thread.

    So network and disk access for the database are no reason to spin up your own threads or use background tasks. But if you do disk, network I/O or CPU intensive operations in the callback, you might need to perform those off the main thread yourself.

提交回复
热议问题