can you help me with this error. getDownloadUrl(); says cannot resolve symbol variable for getDownloadUrl(). I know that getDownloadUrl();is deprecated and i tried reading t
getDownloadUrl
no longer exists.
Take a look at below code if it works for you.
final StorageReference ref = storageRef.child("images/mountains.jpg");
uploadTask = ref.putFile(file);
Task urlTask = uploadTask.continueWithTask(new Continuation>() {
@Override
public Task then(@NonNull Task task) throws Exception {
if (!task.isSuccessful()) {
throw task.getException();
}
// Continue with the task to get the download URL
return ref.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Uri downloadUri = task.getResult();
} else {
// Handle failures
// ...
}
}
});