-2

I want to get list of images which I uploaded manually in web Firebase console. Is there any way I can get list of all files without using FirebaseRecyclerAdapter?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jayanth vn
  • 115
  • 2
  • 12
  • 1
    Where have you stored them and where you want to place them after download? – Dumbo Apr 09 '18 at 06:23
  • If you want to download images from Firebase storage I think the application must know all image names. While you stored them in `List` for example you can use `Glide` external library for smooth and fast image download in `for` cycle. – Dumbo Apr 09 '18 at 07:27

2 Answers2

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?

Philip Cheung
  • 191
  • 1
  • 8
0

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(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if (dataSnapshot.exists()) {
                // dataSnapshot is the "issue" node with all children with id 0
                for (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();
                    }
                }
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
           databaseError.toException();
        }
    });
Mahesh Keshvala
  • 1,349
  • 12
  • 19