Firebase how to get Image Url from firebase storage?

后端 未结 12 698
悲&欢浪女
悲&欢浪女 2020-12-23 15:15

Right now i am fetching image from Storage of Firebase by using below code :

mStoreRef.child("photos/" + model.getBase64Image())
          .getDownl         


        
12条回答
  •  甜味超标
    2020-12-23 15:35

    If you already have download infrastructure based around URLs, or just want a URL to share, you can get the download URL for a file by calling the getDownloadUrl() method on a storage reference.

    // Create a storage reference from our app
    val storageRef = storage.reference
    
     storageRef.child("users/me/profile.png").downloadUrl.addOnSuccessListener {
                // Got the download URL for 'users/me/profile.png'
            }.addOnFailureListener {
                // Handle any errors
            }
    

    firebase documentation

提交回复
热议问题