1

I am working on an android project using firebase for database but i am not able to retrieve the uploaded image as i can't get the url for the image i used .getDownloadUrl() method but it doesn't return the url but com.google.android.gms.tasks.zzu@9501820.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
vu_29
  • 15
  • 3

1 Answers1

3

You will have to register a callback on getDownloadUrl() like below because it is an instance of Task, not String. Task is asynchronous, you can't just do toString() to get an url.

dateRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>(){
        @Override
        public void onSuccess(Uri downloadUrl) {                
           //do something with downloadurl
        } 
    });
Krupal Shah
  • 8,949
  • 11
  • 57
  • 93