This method is supposed to return the downloadUrl but keeps returning null and the weird part is, I can see the URL in the log
private String profileUrlPath(byte[] profile){
mStorageReference.child("card_profile").child(userId+".jpg").putBytes(profile).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
profilepathref.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
if(uri != null){
profileUrl = uri.toString();
Log.d(TAG, "profile image Url: " + profileUrl);
}
}
});
}
});
return profileUrl;
}