I am working on Android Studio and using Firebase Storage, I could upload the images I want, but couldn't get the download url.
I used this:
askSnapshot.getMetadata().getReference().getDownloadUrl().toString();
and this:
filepath.getDownloadUrl().toString();
and the result was the same
it shows me some thing like this:
com.google.android.gms.tasks.zzu@f7d5815
my upload code:
FirebaseStorage storage; StorageReference storageReference;
storage = FirebaseStorage.getInstance(); storageReference = storage.getReference(); final StorageReference filepath = storageReference.child("images").child( "test.jpg");
filepath.putFile(selectedImage).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
bigImageEncoded=filepath.getDownloadUrl().toString();
thumbImageEncoded=taskSnapshot.getMetadata().getReference().getDownloadUrl().toString();
Log.d("download_url",bigImageEncoded);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("erorr",e.getMessage());
}
});
Anyone can help?!! Thanks