Get List Of Images From Firebase Store
Solution 1:
There is no existing method to extract the list of file name you have saved in Firestore. Instead you have to use some workaround to manually create a list. For example, maintaining a list of file and URL inside Firebase database.
One possible solution is to write a trigger using cloud functions, listening to the changes made to Firebase Storage.(as this time you are doing the upload directly through console, you have to write a trigger and host it in cloud function). Upon there is insertion/ removal/ modification in the attachment list, update the dummy file entries inside the firebase database. When you are trying to extract the list of file/ url information, retrieve them from database but not storage.
You may refer to below document for more information: https://firebase.google.com/docs/functions/gcp-storage-events?hl=zh-cn
How to get a list of all files in Cloud Storage in a Firebase app?
Solution 2:
There is no any functionality which can directly fetch your image from firebase storage so first of all, you have to create a database and in that add one field of Imageurl or something like that and then fetch that data or image from the URL using query. For the query build, I already mention code below use that.
mDatabase = FirebaseDatabase.getInstance().getReference();
Query query = mDatabase.child("DatabaseName").orderByChild("ImageUrl");
query.addListenerForSingleValueEvent(newValueEventListener() {
@OverridepublicvoidonDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
// dataSnapshot is the "issue" node with all children with id 0for (DataSnapshot issue : dataSnapshot.getChildren()) {
// do something with the individual "issues"try {
imgeListModel.add(issue.getValue(ImageListModel.class));
Log.e("Get Data", issue.getValue(ImageListModel.class).toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
@OverridepublicvoidonCancelled(DatabaseError databaseError) {
databaseError.toException();
}
});
Post a Comment for "Get List Of Images From Firebase Store"