Skip to content

Instantly share code, notes, and snippets.

@gguuss
Created November 15, 2017 21:30
Show Gist options
  • Save gguuss/158e7ba67d1077db50094af3a64c7d7f to your computer and use it in GitHub Desktop.
Save gguuss/158e7ba67d1077db50094af3a64c7d7f to your computer and use it in GitHub Desktop.
private void retrieveMetadata () {
DocumentReference docRef = mFirestore.collection("images").document(mFileUri.getLastPathSegment());
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
Log.d(TAG, "DocumentSnapshot data: " + task.getResult().getData());
mResponse = ("" + task.getResult().getData()).replaceAll("=", ":");
} else {
Log.d(TAG, "No such document");
mResponse = "No stored label data";
}
} else {
Log.d(TAG, "get failed with ", task.getException());
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment