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


i've android app i'm retrieving data fragment. , believe firebase manages asynchronous calls. still i've doubt if need write firebase code in background thread or not?.

if need write background thread can please tell operations takes more time. eg:

mdatabase = firebasedatabase.getinstance().getreference().child("blog"); 

i think performing on main ui thread may become risk full because setting connection between database may sometime take large time.

the firebase database client performs network , disk operations off main thread.

the firebase database client invokes callbacks code on main thread.

so network , disk access database no reason spin own threads or use background tasks. if disk, network i/o or cpu intensive operations in callback, might need perform off main thread yourself.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -