public void listAllFiles() {
FirebaseStorage storage = FirebaseStorage.getInstance();
// [START storage_list_all]
StorageReference listRef = storage.getReference().child("files/uid");
listRef.listAll()
.addOnSuccessListener(new OnSuccessListener<ListResult>() {
@Override
public void onSuccess(ListResult listResult) {
for (StorageReference prefix : listResult.getPrefixes()) {
// All the prefixes under listRef.
// You may call listAll() recursively on them.
}
for (StorageReference item : listResult.getItems()) {
// All the items under listRef.
}
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Uh-oh, an error occurred!
}
});
// [END storage_list_all]
}