如何通过android将文件保存到Firebase主机文件夹位置? [英] How do you save a file to a Firebase Hosting folder location for images through android?

查看:124
本文介绍了如何通过android将文件保存到Firebase主机文件夹位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Firebase真的很陌生,正在研究如何实施它。我以为它具有类似于Parse的功能,其中可以创建一个ParseFile对象来保存该文件,然后具有上传它的功能,如下所示:

  ParseFile parseFile = new ParseFile(file); 
parseFile.saveInBackground();

如果您有任何建议和/或工作解决方案, p>

我也在研究RetroFit,因为它具有发送MultiPartPost请求的好方法,如果可能会被Firebase捆绑,我还找不到连接。 Firebase Hosting是一个托管静态的服务资产,通常是网站的HTML / CSS /图像。您无法以编程方式将文件添加到Firebase托管服务。



Firebase数据库允许您存储JSON数据。尽管二进制数据不是JSON支持的类型,但是可以使用base64编码二进制数据,从而将图像存储在(大)字符串中。请参阅我可以使用Java API将图像文件存储在Firebase中吗? 请注意,虽然这是可能的,但不建议任何东西,但小图像或作为好奇心,看看它可以做到。



你最好的选择通常是将图像存储在第三方图像存储服务中。


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.

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.

Thanks in advance!

解决方案

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.

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.

Your best option is typically to store the images on a 3rd party image storage service.

这篇关于如何通过android将文件保存到Firebase主机文件夹位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆