and-nd-firebase icon indicating copy to clipboard operation
and-nd-firebase copied to clipboard

How to get downloadUrls for Multiple files in firebase android?

Open DevPokhraj opened this issue 6 years ago • 1 comments

storageReference = mRef.child("Images").child(mAuth.getCurrentUser().getUid()).child(image_name); UploadTask uploadTask = storageReference.putBytes(data); uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { return storageReference.getDownloadUrl(); } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if (task.isSuccessful()) { Uri downloadUri = task.getResult(); //It will return the downloadUrl; //If i tried to store them in the list storeImageUrls.add(downloadUri.toString()); // storeImageUrls is a list

                                }
                            }

}

//If i upload different images to the storage then different images get uploaded but getting only 1 url and it get stored in the list. So, if i upload 10 images, the images get uploaded but getting only 1 url stored like 10 images but same url for 10 images stored in the list.

DevPokhraj avatar Jan 10 '19 04:01 DevPokhraj

I also has this condition

DeepakGurav4444 avatar Feb 28 '20 13:02 DeepakGurav4444