I'm trying to get the URL of the uploaded file, but I get this: com.google.android.gms.tasks.zzu@a12a0cb or something similar.
Here is the code I've tried (kotlin):
val uid = UUID.randomUUID().toString() val storageRef = FirebaseStorage.getInstance().reference.child("content/$uid/$uid.jpg") storageRef.putFile(file).addOnSuccessListener { taskSnapShot -> val downloadUrl = storageRef.downloadUrl FirebaseDatabase.getInstance().reference.child("Photos").child(date).push().setValue(downloadUrl) } But it doesn't work. Also I've tried the following code:
val uid = UUID.randomUUID().toString() val storageRef = FirebaseStorage.getInstance().reference.child("content/$uid/$uid.jpg") storageRef.putFile(file).addOnSuccessListener ( object : OnSuccessListener<UploadTask.TaskSnapshot> { override fun onSuccess(taskSnapshot: UploadTask.TaskSnapshot?) { val downloadUrl = storageRef.downloadUrl FirebaseDatabase.getInstance().reference.child("Photos").child(date).push().setValue(downloadUrl) } } ) But the result is the same. I'm still getting com.google.android.gms.tasks.zzu@a12a0cb inserted into my database, instead of the URL. What I'm doing wrong? I've spent all my day trying to figure it out, please help.