Я пытаюсь получить имена и URL-адреса подпапок и файлов внутри каталога в Firebase Storage.
Но listAll всегда переходит в состояние onFailure
Я попробовал следующий код:
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference listRef = storage.getReference();
listRef = listRef.child("Musics");
Log.d("hafiz", listRef.getName());
listRef.listAll()
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(ListResult listResult) {
for (StorageReference prefix : listResult.getPrefixes()) {
// All the prefixes under listRef.
// You may call listAll() recursively on them.
Log.d("hafiz", prefix.getName());
}
for (StorageReference item : listResult.getItems()) {
// All the items under listRef.
Log.d("hafizitem", item.getName());
}
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Uh-oh, an error occurred!
//
Log.d("jibon", e.getMessage());
}
});
Я получаю эту ошибку:
Произошла неизвестная ошибка, проверьте код результата HTTP и внутреннее исключение ответ сервера.
вот мое правило хранения:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/785 ... -onfailure