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/
Related
I am successfully able to upload an image to firebase and retrieve it also.
My issue is,
I want the uploaded image to not be visible in storage section even for the admin.
Is there a method from which i can Encrypt the Image and store in firebase?
or,
Is there any rules that has to changed for it to work like my requirement?
Thanks in Advance
Firebase Storage can be used to store any type of binary data. So if you don't want the images to be visible by a collaborator on the Firebase project, you can encrypt the data on the client that uploads the data and then decrypt the data on any client that reads it.
This requires no changes to the security rules, as those don't access the binary data of the files.
Hi guys I am making a wallpaper android app.I have stored all my images in firebase storage. Now I have a recyclerview and want to retrieve each of the images into that recyclerView by getting list url of the folders.Is there any way to do that without using the database.I have pasted the json file into my app.
In order to download a image/images from Firebase Storage, you first need to have the corresponding url/urls. To download an image, it requires four steps:
Upload the image to Firebase Storage.
Save the corresponding URL to Cloud Firestore/Firebase Database database while uploading.
Attach a listener on the folder you have saved the image.
Display the image.
So there is no way in which you can download an image without knowing the URL. You cannot get the image list URL directly from Firebase Storage.
First at all you need to have corresponding URLs of your image data stored in Firebase, as mention Alex Mamo. You can build list of this urls during upload or copy them from Firebase Console. Storage API doesn't provide any way how to retreive list of stored files.
Also, you can find Download URL in Image detail/properties. Then you can insert urls into JSON file (or another file, service, firebase storage, whatever) and load them in app.
But be careful, this is not a good idea because Firebase Storage (especially spark plan has limits) allow you download 1GB/day and only 50k/day (download/upload) operations. That will be wasted pretty soon if you don't optimise your data and number of reading operations.
Tip: When you select pay as you go most expensive is GB Downloaded, so you absolutely should store at least 1 thumbnail which will be shown in your recycler view.
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.
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.
I have yet to find any good documentation to tell me how to manage this issue. Is there any guidance someone can reference for this issue?
For an Android app, I have started using Google Firebase Storage along with my realtime Database, and I have a question on how to ensure file uploads and database updates happen in the proper order.
Previously, I was encoding an audio file to a string and uploading it to FB Database along with other related data as a single hash map to ensure consistency. The related data that is being stored is a POJO relating to what users can access the audio, the path where the audio is stored in the database, and more.
My new set up is first to upload the audio file to FB Storage, and, once the file is uploaded, trigger a FB Database update for the related data. Once the database listener indicates completion, the app moves to a different activity.
I am concerned that this two step process is unstable (user leaves the activity before both tasks are done, Storage upload is interrupted and Database update never occurs, etc.). If the Database information isn't updated, the other users won't be notified that the audio file is online and they won't have the path to reference it stored in the database.
What is the proper order for structuring simultaneous Storage and Database uploads in the new Google Firebase?
Thanks,
Andy
Not sure why there are no solid answers for this yet. Anyway, I have faced very similar problems and eventually resorted with nested-updates using completion blocks (exactly how you described in your question).
Very recently, Firebase introduced cloud functions. I am utilizing this to watch the files that are uploaded, and then create a metadata entry into FB Database with the cloud function.
Basically, I use childByAutoId() to generate a key which is used to name the file. For example, profile pictures are saved at "gs://bucket-id/profile_pictures/somerandomkey.jpeg". Then I create a metadata entry into my FB database with cloud functions by utilizing the key from the filename.
I am not sure if there is a better way, but using cloud functions surely seems like a better approach than the nested-updates approach.
You can upload image using Firebase Storage, in success you get a downloadable URL of that image. Then put all the values in the custom object including that image URL and save that object in RealTime Database of Firebase.
And you can use the image URL by retrieving object from RealTime Database.