Search code examples
androidfirebasegoogle-cloud-firestoremetrics

Android Firestore snapshotlistener metric registering without an event listener


I do not have any snapshotlisteners in my app like onEvent(blah). But the metrics show I snapshotListeners active have when I make get() calls even after the call is finished.

 getFirebaseFirestoreDB()
                .collection(FeedConstants.DISPLAY_POST_COLLECTION)
                .orderBy(Post.DISPLAY_POST_CREATION_DATE, Query.Direction.DESCENDING)
                .whereEqualTo(Post.DISPLAY_POST_CATEGORY_ID, categoryId)
                .get()
                .addOnCompleteListener(onCompleteListener);

final OnCompleteListener onCompleteListener = new OnCompleteListener<QuerySnapshot>() {
            @Override
            public void onComplete(@NonNull Task<QuerySnapshot> task) {
                Log.d(TAG, "OnComplete Task returned");
                if (task.isSuccessful()) {
                    Log.d(TAG, "Success getting documents initial load");
                    Log.d(TAG, "Size is: " + task.getResult().size());
                    //do stuff
    }


Solution

  • It turned out to be the Firebase Firestore console. It will set a listener when you open it up and do reads respectively. Mystery solved.