UploadTask.TaskSnapshot doesn't have getDownloadUrl() method
See original GitHub issueI’m following a tutorial teaching how to upload images to Firebase. At certain moment the instructor will write the code to get the download URL after uploading by using getDownloadUrl()
method from UploadTask.TaskSnapshot
, but for me, this method doesn’t exist.
Based on another code I found, I tried the following:
OnSuccessListener<UploadTask.TaskSnapshot> upload = new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
ChatroomMessage message = new ChatroomMessage(null, mUsername, taskSnapshot.getDownloadUrl());
mMessagesDatabaseReference.push().setValue(message);
}
};
Because it is similar to what’s shown in the documentation, but I didn’t understand it very well. How to implement it?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:41
Top Results From Across the Web
taskSnapshot.getDownloadUrl() method not working
In Firebase Storage API version 16.0.1, the getDownloadUrl() method using taskSnapshot object has changed. now you can use, taskSnapshot.
Read more >UploadTask.TaskSnapshot | Firebase - Google
class UploadTask.TaskSnapshot : StorageTask.SnapshotBase ... Encapsulates state about the running UploadTask. Summary. Public constructors. TaskSnapshot() ...
Read more >Android – taskSnapshot.getDownloadUrl() method not working
firebaser here This answer is wrong. While it at first may appear to work (since it compiles) the result of getDownloadUrl().toString() is not...
Read more >What do I use instead of .getdownloadurl in android firebase?
Solved: I changed. Java. Uri firebaseUri = taskSnapshot.getDownloadUrl(); to. Java. Task<Uri> firebaseUri = taskSnapshot.getStorage().
Read more >Upload files with Cloud Storage on Flutter - FlutterFire
After uploading a file, you can get a URL to download the file by calling the getDownloadUrl() method on the Reference : await...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes they deprecated and then removed that method. I use the following code, similar to what is written in the docs.
@DevRyz3n running this command would raise FileNotFoundException as the returned value is not the download url for file. Instead try this code where I have created a Task object to perform getDownloadUrl() task, waited for its completion in the main thread and then obtained the URL through getResult() function.