0

Okay so I already read what's in the doc but unfortunately there's no sample about the new way of getting download Uri. How am I supposed to get it after uploading a image file? Another thing is that I saw some example using Task here in stack but what is the essence of changing the way of getting a download uri? I am trying to do it but now it seems too complicated. I don't really understand why they deprecate it and change it.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • See https://stackoverflow.com/questions/50660975/firebase-storage-getdownloadurl-method-cant-be-resolved, https://stackoverflow.com/questions/50554548/error-cannot-find-symbol-method-getdownloadurl-of-type-com-google-firebase-st, https://stackoverflow.com/questions/50594843/error-cannot-find-symbol-method-getdownloadurl – Frank van Puffelen Jun 26 '18 at 03:48
  • @FrankvanPuffelen how am I supposed to get it if I use UploadTask instead of StorageReference like this mThumbnailTask = mStorageRef.child(getResources().getString(R.string.userProfilePic) + "/-thumbnails").child(mAuth.getCurrentUser().getUid()+".jpg") .putBytes(thumbData); –  Jun 26 '18 at 04:11
  • You *are* using a reference. E.g. `StorageReference ref = mStorageRef.child(getResources().getString(R.string.userProfilePic) + "/-thumbnails").child(mAuth.getCurrentUser().getUid()+".jpg")`. Then call `ref.putBytes(...` to start uploading and `ref.getDownloadUrl(...` to get the download URL. – Frank van Puffelen Jun 26 '18 at 13:08
  • Thanks anyway I am able to get the download uri with UploadTask using Objects.requireNonNull(Objects.requireNonNull(taskSnapshot.getMetadata()).getReference()).getDownloadUrl().addOnSuccessListener(new OnSuccessListener() { @Override public void onSuccess(Uri uri) { } –  Jun 26 '18 at 14:26

0 Answers0