and-nd-firebase icon indicating copy to clipboard operation
and-nd-firebase copied to clipboard

Uri downloadUrl = taskSnapshot.getDownloadUrl(); not working

Open hpols opened this issue 6 years ago • 6 comments

getDownloadUrl() does not seem to exist anymore. Looking at the firebase-documentation it looks like this method is called on the reference now not taskSnapShot. I have tried the following but the image is not uploaded:

StorageReference taskSnapshotStorage = taskSnapshot.getStorage();
                       Uri downloadUrl = taskSnapshotStorage.getDownloadUrl().getResult();

hpols avatar Aug 14 '18 18:08 hpols

Try using this

Task<Uri> task = taskSnapshot.getMetadata().getReference().getDownloadUrl();
task.addOnSuccessListener(new OnSuccessListener<Uri>() {
       @Override
        public void onSuccess(Uri uri) {
              String photoLink = uri.toString();
        }
});

AmrDeveloper avatar Aug 27 '18 18:08 AmrDeveloper

This things works.... tnxs alot... i worked for me after trying so many solutions

Habtesoft avatar Sep 04 '18 10:09 Habtesoft

I faced the same problem but I got the answer

Just add .getStorage() infront of .getDownloadurl

to be like this below

.getStorage().getDownloadUrl 

LEAVE EVERYTHING IN THAT LINE DONT ALTER JUST ADD .getStorage()

kevinkoech avatar Feb 09 '19 12:02 kevinkoech

I hope this gist might help you: https://gist.github.com/jonathanbcsouza/13929ab81077645f1033bf9ce45beaab

jonathanbcsouza avatar Jan 15 '20 09:01 jonathanbcsouza

I have a problem, I am getting the storage location instead of the download URL. From my Firebase storage. How can I fix this?

I tried the code below.

Task<Uri> task = taskSnapshot.getMetadata().getReference().getDownloadUrl(); task.addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { String photoLink = uri.toString(); } });

Kanyandula avatar May 14 '20 07:05 Kanyandula

Worked really well for me. Thanks

martha170687 avatar Jul 02 '23 01:07 martha170687