Last active
December 22, 2017 08:50
-
-
Save RBonaventure/12283d6115d9960421470dde949acc41 to your computer and use it in GitHub Desktop.
firestore-fetch-data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @see Firebase Performance | |
Traces.start(Traces.COLLABORATORS_TIME); | |
// Fetch collaborators list from Firestore | |
Collaborator.getAll(new OnCompleteListener<QuerySnapshot>() { | |
@Override | |
public void onComplete(@NonNull Task<QuerySnapshot> task) { | |
if(task.isSuccessful()) { | |
mCollaborators = task.getResult(); | |
CollaboratorsAdapter.this.notifyDataSetChanged(); | |
} | |
Traces.stop(Traces.COLLABORATORS_TIME); | |
} | |
}); | |
// Collaborator.java#getAll | |
public static void getAll(OnCompleteListener<QuerySnapshot> listener) { | |
FirebaseFirestore.getInstance() | |
.collection(FirestoreCollections.RESOURCES).get().addOnCompleteListener(listener); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment