Q: How to retrieve document size without addSnapshotListener? I have the code that retrieving the size of document using addSnapshotListener.
I just know retrieve doc size using addSnapshotListener but don't know any other way.
firestore.collection("DemandHistory").addSnapshotListener(new EventListener<QuerySnapshot>() {
       @Override
       public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) {

            if (queryDocumentSnapshots != null){
               int count = queryDocumentSnapshots.size();
            }
       }
});

I want to retrieve doc size without addSnaphsotListener, how to do it?

A: 
I have the code that retrieving the size of document using addSnapshotListener

Calling .addSnapshotListener() on a CollectionReference object means you want to get data in realtime. Calling size() method on a QueryDocumentSnapshots object it doesn't mean that you are getting the size of a document, you are getting the number of all documents that exist within your DemandHistory collection.
You don't need to worry regarding the size of a single document as long as you keep it below the maximum size which is 1 Megabyte. Please see more details in the official documentation regarding Usage and limits:

Maximum size for a document:1 MiB (1,048,576 bytes)

If you don't want to get data in realtime, instead of adding a listener simply use a get() call as explained here.
If you want to know the size of a document, there is a library for that:


*

*https://github.com/alexmamo/FirestoreDocument-Android/tree/master/firestore-document
