title: download url is getting as com.google.android.gms.tasks.zzu@441922b while using taskSnapshot.getMetadata().getReference().getDownloadUrl()
body: <p>I have to upload certain informations into realtime database. All details were uploaded correctly into it except image url. Using taskSnapshot.getMetadata().getReference().getDownloadUrl() I got something like com.google.android.gms.tasks.zzu@441922b as image link. The file is uploaded in the storage. But I dont get the exact download url to access it. Codes are added below</p>
  
  <p>Profileregistration.java</p>
  
  <pre><code>import androidx.annotation.NonNull;
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.content.ContentResolver;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.Handler;
  import android.view.View;
  import android.webkit.MimeTypeMap;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.ProgressBar;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.android.gms.tasks.OnFailureListener;
  import com.google.android.gms.tasks.OnSuccessListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.storage.FirebaseStorage;
  import com.google.firebase.storage.OnProgressListener;
  import com.google.firebase.storage.StorageReference;
  import com.google.firebase.storage.StorageTask;
  import com.google.firebase.storage.UploadTask;
  import com.squareup.picasso.Picasso;
  
  public class Profileregistration extends AppCompatActivity{
  
      EditText hname, phone, hlocation;
      ImageView image;
      String name,email,house,location,number,photostring;
      Button register;
  
      private static final int PICK_IMAGE_REQUEST = 1;
      private Uri mImageUri;
  
      private StorageReference mStorageRef;
      private DatabaseReference mDatabaseRef;
      private ProgressBar mProgressBar;
  
      private StorageTask mUploadTask;
  
      private FirebaseAuth firebaseAuth;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_profileregistration);
  
          firebaseAuth = FirebaseAuth.getInstance();
  
          Intent intent = getIntent();
          hname = (EditText) findViewById(R.id.userreghouse);
          phone = (EditText) findViewById(R.id.userregphone);
          hlocation = (EditText) findViewById(R.id.userreglocation);
          name = intent.getExtras().getString("name");
          email = intent.getExtras().getString("email");
          house = hname.getText().toString().trim();
          location = hlocation.getText().toString().trim();
          number = phone.getText().toString().trim();
          mProgressBar = findViewById(R.id.progress_bar);
  
          mStorageRef = FirebaseStorage.getInstance().getReference("userdetails");
          mDatabaseRef = FirebaseDatabase.getInstance().getReference("userdetails");
  
          image = (ImageView) findViewById(R.id.userregprofilepic);
          image.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  openFileChooser();
              }
          });
          register = (Button) findViewById(R.id.regprofilebutton);
          register.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if (mUploadTask != null &amp;&amp; mUploadTask.isInProgress()) {
                      Toast.makeText(Profileregistration.this, "Upload in progress", Toast.LENGTH_SHORT).show();
                  }
                  else {
                      uploadFile();
                  }
              }
          });
  
      }
  
      private void openFileChooser() {
          Intent intent = new Intent();
          intent.setType("image/*");
          intent.setAction(Intent.ACTION_GET_CONTENT);
          startActivityForResult(intent, PICK_IMAGE_REQUEST);
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == PICK_IMAGE_REQUEST &amp;&amp; resultCode == RESULT_OK
                  &amp;&amp; data != null &amp;&amp; data.getData() != null) {
              mImageUri = data.getData();
              Picasso.with(this).load(mImageUri).into(image);
          }
      }
  
      private String getFileExtension(Uri uri) {
          ContentResolver cR = getContentResolver();
          MimeTypeMap mime = MimeTypeMap.getSingleton();
          return mime.getExtensionFromMimeType(cR.getType(uri));
      }
  
      private void uploadFile() {
          if (mImageUri != null) {
              StorageReference fileReference = mStorageRef.child(phone.getText().toString().trim()
                      + "." + getFileExtension(mImageUri));
  
              mUploadTask = fileReference.putFile(mImageUri)
                      .addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                          @Override
                          public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  
                              final Task&lt;Uri&gt; result = taskSnapshot.getMetadata().getReference().getDownloadUrl();
                              result.addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
                                  @Override
                                  public void onSuccess(Uri uri) {
                                      photostring = result.toString();
                                  }
                              });
                              Handler handler = new Handler();
                              handler.postDelayed(new Runnable() {
                                  @Override
                                  public void run() {
                                      mProgressBar.setProgress(0);
                                  }
                              }, 500);
  
                              FirebaseUser user = firebaseAuth.getCurrentUser();
                              String useremail=user.getEmail().replace("@","").replace(".","");
  
                              Toast.makeText(Profileregistration.this, "Upload successful", Toast.LENGTH_LONG).show();
                              Upload upload = new Upload(name,user.getEmail(),hname.getText().toString().trim(),hlocation.getText().toString().trim(),
                                      phone.getText().toString().trim(),result.toString());
                              String uploadId = useremail;
                              mDatabaseRef.child(uploadId).setValue(upload);
                              finish();
                              startActivity(new Intent(getApplicationContext(), Homewindow.class));
                          }
                      })
                      .addOnFailureListener(new OnFailureListener() {
                          @Override
                          public void onFailure(@NonNull Exception e) {
                              Toast.makeText(Profileregistration.this, e.getMessage(), Toast.LENGTH_SHORT).show();
                          }
                      })
                      .addOnProgressListener(new OnProgressListener&lt;UploadTask.TaskSnapshot&gt;() {
                          @Override
                          public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
                              double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount());
                              mProgressBar.setProgress((int) progress);
                          }
                      });
          } else {
              Toast.makeText(this, "No file selected", Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>
  
  <p>Upload.java</p>
  
  <pre><code>public class Upload {
      private String mEmail;
      private String mPhone;
      private String mHname;
      private String mHlocation;
      private String mName;
      private String mImageUrl;
  
      public Upload() {
          //empty constructor needed
      }
  
      public Upload(String name,String email,String house,String location,String phone,String imageUrl) {
          if (name.trim().equals("")) {
              name = "No Name";
          }
  
          mName = name;
          mEmail = email;
          mHname = house;
          mHlocation = location;
          mPhone = phone;
          mImageUrl = imageUrl;
      }
  
      public String getName() {
          return mName;
      }
  
      public void setName(String name) {
          mName = name;
      }
  
      public String getEmail() {
          return mEmail;
      }
  
      public void setEmail(String email) {
          mEmail = email;
      }
  
      public String getHname() {
          return mHname;
      }
  
      public void setHouse(String house) {
          mHname = house;
      }
  
      public String getHlocation() {
          return mHlocation;
      }
  
      public void setLocation(String location) {
          mHlocation = location;
      }
  
      public String getPhone() {
          return mPhone;
      }
  
      public void setmPhone(String phone) {
          mPhone = phone;
      }
  
      public String getImageUrl() {
          return mImageUrl;
      }
  
      public void setImageUrl(String imageUrl) {
          mImageUrl = imageUrl;
      }
  }
  </code></pre>
  
  <p>I dont know why I am getting such error and also is there any error in codes.
  Please help me.</p>