Todd
Todd

Reputation: 49

List files in a directory in a firebase storage on android

Firebase doesn't have an API to list all the files in particular directory in Storage yet. I've read about situations where people combine Storage with the Realtime Database to list the URL for files stored in Storage.

I'll be storing document files (pdf, word, ppts) in firebase and read them with a webview plugin in the app. Can someone provide me with an example on how to achieve this with a list adapter that shows the list of files that when clicked, downloads the file and shows its content in a webview? Thanks!

Upvotes: 2

Views: 4894

Answers (2)

Rogerio Setubal
Rogerio Setubal

Reputation: 79

Currently Firebase Storage doesn't has any function to list a folder content directly. If you real need it, you should store the metadata of the files (such as the download URLs) in a place where you can list them, like the Firebase Database. For instance, you can create a child node, in Firebase Database, with the same name of your folder in Firebase Storage and then store the download URL of each file. So you can easily access/use/share the URLs as well as list them.

Best Regards!

Upvotes: 1

Richie Rich
Richie Rich

Reputation: 27

As you put each file, get the downloadURL and then make a list of files in the database, with the downloadURL, and any other file info you care to grab, either from the metadata, or let your user create entries. If you can do basic operations with Firebase, it should be easy.

Upvotes: 0

Related Questions