Externally link to files stored on Firebase Storage? - android

Is there any way possible to get a direct URL to download the media file which I have uploaded onto the Firebase storage using my Android app?.
Scenario 1 :- I am basically looking for a http or a https URL which I can paste it in the browser and the image can be downloaded.
Scenario 2:- I can get a public url so that I can write a download manager in my web app which can download the images from these urls.
Also, If possible I want it to be completely independent of any reference of firebase database.
Thanks in advance.

When you upload the file, a URL for the stored file is available in the returned UploadTask.TaskSnapshot. You can also obtain the URL from a StorageReference using getDownLoadUrl().
An example can be found in the Firebase Quickstart project.

You can use Fibrebase SDK on your server-side to download any stored file to serve it when a client requests it by name for example.

Related

How can I access a file on firebase storage by the download url when I just have access to the file name?

So, I just want to swap some things in the download url to make users be able to search for files in the storage. it's just that I don't want to swap the long code in the end, because then users will have to use that super long code. I have to use the url to access the files.
https://firebasestorage.googleapis.com/v0/b/socialmedia-
1df9e.appspot.com/o/images%2Flego?alt=media&token=4cc05dec-8dda-4f46-a8a7-
eb1bf916c512 ⇈ ⇈
swap this Not this
It's not supported to construct your own download URLs. You should be using the Firebase SDK to generate download URLs that are special for each file you want to download.

Android Firebase Storage

I am developing an Android app to share doc(generally pdf) between student and teachers(two different app one as a server and another as a client).Uploading a file to the firebase storage is done. The problem is that I want a list of uploaded file with download thumbnail/button in the student app. How to do it?
Please help me out.
I don't think you can do it as there is no API till now. All you can do is Store the link generated for each file in the Realtime database and then use this list of URL.
Or use cloud functions to manipulate your uploads and then store generated URL in some file and retrieve this file for list of files.
For more please refer this post.
https://stackoverflow.com/a/37337436/4517450
https://firebase.google.com/docs/database/

Upload image in firebase Storage using a link

I want to upload images in firebase storage. I know how to upload images in firebase using Uri. But is there a way in which I can upload images to firebase using a link?
I am using an API in my project and I can only hit it 1000 per month so I am trying to save images in firebase as soon as it is fetched from API.
the API gives a link to the image which I use to show images in imageview with Picasso.
suppose my link is http://xxx.xx.xxx.......png? I have converted it into Uri
using Uri.parse(link). Firebase gives me an exception when I try to do so.
The exception
StorageException: No content provider: http://xx.xx.com/xx/xx/xxx/xx/xx.png?
java.io.FileNotFoundException: No content provider: http://xx.xx.com/xx/xx/xx/xx/xx.png?
The Firebase Storage SDK will not work with remote files like that. You can't pass it an HTTP URL and expect that it will download that remote file, then upload it to storage. You have to download the remote file first, then upload it.
If it's not clear, the Uri that you pass it must refer to a local file only.

Getting download url of multiple files inside Firebase Storage

I am creating an Android App where Firebase is the backed. In my app, I have some selected images that I have stored inside my Firebase storage by direct uploading (Without coding).
Now I have to view that images in my app through a recycle view. For that purpose, I have to get the download URL of all the images and put them into my Firebase real-time database programmatically so that I can access the URL to my app. Is there any methods available for that?
I have tried to iterate through storage, unfortunately there is no method for that.
There is currently no way to iterate a list of files in Firebase Storage using the Firebase SDKs. Instead, after you upload a file, you should also store its download URL in Firebase Realtime Database (or some other place) that you can query for the download URLs.
I was searching for a proper answer to this question for 2 days. What i found is, There is no proper API or Class in Firebase Storage for the same purpose. If you guys want to do the same effectively, get the files in your code programmatically and upload them to firebase storage through a loop. Through that you can get the download links after uploading of each files. Store it in the Real time Database of Firebase.
You can create a function that can can return a file. You can set up a /link url in the hosting to that function.

How to upload Image to Hosting directly without php in Android?

I'd like to upload images to my own hosting, I don't want to use upload services . Please can you suggest any library to be implemented.
You can try using a FTP Client (like this one )to upload directly to your hosting, but anyway you'll need to send the file name and the location of the file via php...

Categories

Resources