downloadUrl无法调用addOnsuccessListener

时间:2018-11-02 17:03:59

标签: kotlin firebase-storage

FireBase存储布局:

image

我如何获得downloadURl才能成功在Firebase存储中下载和上传图像。当我运行下面的代码时,我似乎总是以addOnFailureListener结尾。

val storageRef = FirebaseStorage.getInstance().reference.child("image/Calendar.png")

storageRef.downloadUrl.addOnSuccessListener { uri ->
        Picasso.with(applicationContext).load(uri.toString()).into(image)
        Toast.makeText(applicationContext, uri.toString(), Toast.LENGTH_LONG).show()
    }.addOnFailureListener(){
        Toast.makeText(applicationContext, "fail", Toast.LENGTH_LONG).show()
}

0 个答案:

没有答案