How do you save a file to a Firebase Hosting folder location for images through android?(如何通过 android 将文件保存到 Firebase 托管文件夹位置以获取图像?)
问题描述
我是 Firebase 的新手,目前正在研究如何实施它.我在想它具有类似于 Parse 的功能,其中可以创建一个 ParseFile 对象来保存文件,然后具有上传它的功能,如下所示:
I'm really new to Firebase and am studying how to implement it right now. I was thinking that it has functions similar to Parse where a ParseFile object can be created that holds the file and then has functions to upload it something like the following :
ParseFile parseFile = new ParseFile(file);
parseFile.saveInBackground();
如果您有建议和/或可行的解决方案,请发布它们,因为它们将非常有用.
If you have suggestions and/or working solutions do post them as they will be exceptionally useful.
我也在研究 RetroFit,因为它有一种发送 MultiPartPost 请求的好方法,如果可以与 Firebase 绑定,我只是找不到连接.
I am also studying about RetroFit as it has a great way of sending MultiPartPost requests and if ever could be tied up with Firebase I just can't find the connection yet.
提前致谢!
推荐答案
Firebase 托管是一种托管静态资产的服务,通常是网站的 HTML/CSS/图像.您不能以编程方式将文件添加到 Firebase 托管.
Firebase Hosting is a service for hosting static assets, typically the HTML/CSS/images of a web site. You cannot programmatically add files to Firebase Hosting.
Firebase 数据库允许您存储 JSON 数据.虽然二进制数据不是 JSON 支持的类型,但可以使用 base64 对二进制数据进行编码,从而将图像存储在(大)字符串中.请参阅 我可以使用 Java API 将图像文件存储在 firebase 中吗? 请注意,虽然这是可能的,但不建议将其用于小图像或好奇是否可以这样做.
The Firebase Database allows you to store JSON data. While binary data is not a type that is supported in JSON, it is possible to encode the binary data in say base64 and thus store the image in a (large) string. See Can I store image files in firebase using Java API? Note that while this is possible, it is not recommended for anything but small images or as a curiosity to see that it can be done.
您的最佳选择通常是将图像存储在第 3 方图像存储服务上.
Your best option is typically to store the images on a 3rd party image storage service.
这篇关于如何通过 android 将文件保存到 Firebase 托管文件夹位置以获取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何通过 android 将文件保存到 Firebase 托管文件夹位置以获取图像?
基础教程推荐
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01