简体   繁体   中英

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!

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM