first of all create database ref and a File like this
StorageReference downloadRef = FirebaseStorage.getInstance().getReference().child("Wall/" + category
+ "https://stackoverflow.com/" + wall_id + ".jpg");
File localFile = null;
try {
String fileName = wall_id + ".jpg";
localFile = new File();//create your file with desired path
} catch (Exception e) {
e.printStackTrace();
}
than call getFile on that reference like this
downloadRef.getFile(localFile)
.addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
dialog.dismiss();
}
}).addOnProgressListener(new OnProgressListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) {}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Toast.makeText(WallOptionActivity.this, "Download failed!", Toast.LENGTH_SHORT).show();
}
});
the file will be saved to given path.
solved Download image from firebase to external sd Card using url [closed]