CLICK TO SEE THE ACTIVITY WHERE THE DOWNLOAD URL OF THE IMAGE UPLOADED TO THE FIREBASE STORAGE IS REQUIRED. I Want to get the Download URL of the uploaded image. getDownlaodUrl() is not working as it has been deprecated lately.So I want the alternate of that, so that I can use that url to display the image which i uploaded on the firebase storage in another activity using Picasso. So kindly tell me how to Retrieve the download URL of the images on the Firebase Storage.
Asked
Active
Viewed 445 times
0
-
2is this a typo while posting question or you are using as it is `getDownlaodUrl() `?, because function is there in documentation. https://firebase.google.com/docs/reference/android/com/google/firebase/storage/StorageReference – karan Nov 16 '18 at 10:59
-
It is not a typo. I used mStorage.getDownloadUrl().toString(); This gave an error , Required : String ; Found : Task
– varun sonava Nov 16 '18 at 11:50
2 Answers
1
Use getDownloadUri()
as below it has changed in recent version, check documentation here https://firebase.google.com/docs/storage/android/download-files#download_data_via_url
getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
System.out.println(uri.toString());
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});

karan
- 8,637
- 3
- 41
- 78
0
Instead of mStorage object name just use this
downloadUrl = taskSnapshot.getDownloadUrl().toString();

TEST
- 32
- 10