Firebase database - run on different thread

前端 未结 1 1487
青春惊慌失措
青春惊慌失措 2020-12-11 21:13

I want to run the events of firebase on different thread. On the last version of firebase I had this code that did it

    Config firebaseConfig = new Config(         


        
相关标签:
1条回答
  • 2020-12-11 21:59

    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.

    In most situations you don't have to do anything special and can just let the Firebase client deal with the cross-threading handling. Only when you need to do some heavy work in your callback (e.g. onDataChange()) will you have to run that work off the main thread again. You can use the usual Android threading mechanisms for that.

    0 讨论(0)
提交回复
热议问题