Can documents be retrieved synchronously from the cache?
For Android, the documentation only gives an asynchronous example?
DocumentReference docRef = db.collection("cities").document("SF");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
...
}
}
});
UPDATE:
It seems to me that the onComplete gets called only when the data is coming from the server. It doesn't seem to get ever called with cached data.
Can anyone confirm?