Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active April 17, 2019 05:49
Show Gist options
  • Select an option

  • Save jirawatee/cb25be320aa3440f54f5a8287a1451aa to your computer and use it in GitHub Desktop.

Select an option

Save jirawatee/cb25be320aa3440f54f5a8287a1451aa to your computer and use it in GitHub Desktop.
Firebase Storage - Update file metadata
private void updateMetaData() {
Helper.showDialog(this);
StorageMetadata metadata = new StorageMetadata.Builder().setCustomMetadata("country", "Thailand").build();
imageRef.updateMetadata(metadata).addOnSuccessListener(new OnSuccessListener<StorageMetadata>() {
@Override
public void onSuccess(StorageMetadata storageMetadata) {
Helper.dismissDialog();
mTextView.setText(String.format("Country: %s", storageMetadata.getCustomMetadata("country")));
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Helper.dismissDialog();
mTextView.setText(String.format("Failure: %s", exception.getMessage()));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment