繁体   English   中英

在 firebase 存储上获取 URL 图像

[英]Get URL of image on firebase storage

如何在我的 firebase 存储中获取图像的 url,然后将其放入我的实时数据库中。

在此处输入图像描述

点击此链接- https://firebase.google.com/docs/storage/android/download-files#download_data_via_url

storageRef.child("users/me/profile.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
    @Override
    public void onSuccess(Uri uri) {
        // Got the download URL for 'users/me/profile.png'
        Uri downloadUri = taskSnapshot.getMetadata().getDownloadUrl();
        generatedFilePath = downloadUri.toString(); /// The string(file link) that you need
    }
}).addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception exception) {
        // Handle any errors
    }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM