'Android - Download File from Firebase by means of only URL

I'm developing a simple Android application that downloads a file from Firebase storage.

Is there any way to download a file getting only a link to the file? I found a few methods but they were requiring also the name of file

I don't know the name of downloading file, I need to download the file knowing only its URL.




Solution 1:[1]

Just try this :

FirebaseStorage storage = FirebaseStorage.getInstance();

StorageReference httpsReference = storage.getReferenceFromUrl("YOUR_FIREBASE_STORAGE_URL");

File localFile = File.createTempFile("PREFIX_FILE", "SUFFIX_FILE");

httpsReference.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
    @Override
    public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
        // Local temp file has been created
    }
}).addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception exception) {
        // Handle any errors
    }
});

Firebase Storage documentation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pipiks