0

I was able to successfully store files in the firebase storage, but now I am having a problem. I am storing multiple images in a directory / folder but I am only able to retrieve one? How do I iterate through all files in a folder? I know you can do this with FirebaseDatabase snapshots by using an enhanced for loop, but this is not possible for FirebaseStorage, no?

FirebaseStorage.getInstance().getReference().child(listing.authorUid).child(listing.adId).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
       @Override
           public void onSuccess(Uri uri) {
              //for(Uri child : uri.getChildren()) ???
           }
       });
  • Possible duplicate of [How to get a list of all files in Cloud Storage in a Firebase app?](https://stackoverflow.com/questions/37335102/how-to-get-a-list-of-all-files-in-cloud-storage-in-a-firebase-app) – Sohel S9 Feb 21 '19 at 12:04
  • Bad news: no way. That's one of the reasons why I gave up with Firebase. – Fabio Marzocca May 17 '19 at 14:52

1 Answers1

0

Use listall option with firebase storage reference. This will return the list of all files as items.

root.child('images/uid').listAll() 

Will return the file as an item.

borchvm
  • 3,533
  • 16
  • 44
  • 45