whenever i use this method to retrieve stored image url in firebase storage
taskSnapshot.getMetadata().getReference().getDownloadUrl().toString();
I expect that this method will return the download url of saved image, but what it returns is something with this format com.google.android.gms.tasks.zzu@41f55k88
here is firebase database tree
here is my code snippet.
final StorageReference filePath = userProfileImageRef.child(currentUserID + ".jpg");
filePath.putFile(resultUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
final String downloadUrl = taskSnapshot.getMetadata().getReference().getDownloadUrl().toString();
Log.d("url", downloadUrl);
usersRef.child("profileimage").setValue(downloadUrl).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(SetupActivity.this, "Image stored", Toast.LENGTH_SHORT).show();
} else {
String message = task.getException().getMessage();
Toast.makeText(SetupActivity.this, "Error: " + message, Toast.LENGTH_SHORT).show();
}
}
});
}
});