The official documentation gives only an asynchronous example, because synchronous does not exist. All read operations performed either from the cache or via the Internet directly from Firebase, asynchronous servers, and you cannot change this behavior.
What you request can be done on a regular JVM, with the usual Java synchronization primitives, but this will not work on Android.
source share