如何使Firebase存储引用某个存储桶? [英] How to make firebase storage reference to a certain bucket?
问题描述
我在离我的用户位置(asia-southeast1)附近的区域中创建了一个新存储桶,因此希望它可以更快地在客户端获取图像,我想上传图像,还希望从该新存储桶中下载图像. /p>
但我不知道如何引用该新存储桶.通常我会在Android中使用以下代码为默认存储桶创建引用
val ref = FirebaseStorage.getInstance().reference.child("profilePicture")
那么如何从该存储桶下载和上传图像?我认为创建引用时必须做些更改,但是我不知道如何将引用指向该新存储桶
从 @samthecodingman 获取信息并对其进行测试之后,我可以使用下面的代码设置使用特定存储桶的引用
FirebaseStorage.getInstance("gs://yourBucketNameHere").reference.child("profilePicture")
不要忘记在字符串中添加 gs://作为 so how to download and upload image from that bucket? I assume that I have to make some change when creating the reference, but I don't know how to pointing the reference to that new bucket After getting info from @samthecodingman and testing it, I can set a reference to use a certain bucket using the code below Don't forget to add gs:// in your string as documented here. 这篇关于如何使Firebase存储引用某个存储桶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!FirebaseStorage.getInstance("gs://yourBucketNameHere").reference.child("profilePicture")