How to download image file from Firebase storage To sd card

Divakar Luffy

i am trying to download a image file form firebase storage. i want image to be stored in local sd card . i have stored my file island.jpg in my firebase stroage. But the code is not fleaching the file on to my sd card

 public void downloadpdf(){

        StorageReference  islandRef = mStorage.child("images/island.jpg");

        File localFile = null;

        try {
            localFile = File.createTempFile("images", "jpg");
        } catch (IOException e) {
            e.printStackTrace();
        }


        islandRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {

                System.out.println("kudos");
                // Local temp file has been created
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                // Handle any errors
            }
        });
    }

when ever i call the above method i am able to print "kudos" so is this means i have downloaded my content ,but i am not able to find image on my sd card.

Bob Snyder

Use the form of createTempFile() that takes a parameter for directory and specify the external files directory. Then print the path of the file to see where it is created:

try {
    localFile = File.createTempFile("images", "jpg", getExternalFilesDir(null));
} catch (IOException e) {
    e.printStackTrace();
}
System.out.println("localFile=" + localFile.getAbsolutePath());

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Download image from firebase to external sd Card using url

From Dev

How to download a linux image, unzip it and write it to an SD card in one line?

From Dev

How to download a linux image, unzip it and write it to an SD card in one line?

From Dev

How to write a file in external sd card and not in device storage?

From Dev

Firebase download image from Storage directly

From Dev

Hide a file from SD card

From Dev

How to save and get path of image Cropped Android from sd card?

From Dev

How to load image from SD card using Picasso library

From Dev

How to use Cygwin to copy an image from an SD memory card

From Dev

How show progress bar while read file from SD card

From Dev

How to build an sd card image, without an sd card?

From Dev

Use DownloadManager to download files to real SD card, not to emulated storage

From Dev

Use DownloadManager to download files to real SD card, not to emulated storage

From Dev

Android: write bytes to image file on SD Card

From Dev

SD Card as Permanent Storage?

From Dev

download text file from firebase storage and displaying on a web page

From Dev

Open file from Firebase Storage in new table and not download

From Dev

How to bind image in angularjs from firebase storage

From Dev

How to send image in a sd card through bluetooth

From Dev

How to copy image to an existing directory on sd card?

From Dev

How to save transformed image to SD card

From Dev

Exception while reading file from SD Card

From Dev

Pick a file from an SD card using Intent

From Dev

Get path of Specific file from SD Card

From Dev

Arduino reading a database file from sd card

From Dev

Convert Video File from SD Card to audio

From Dev

Reading file from SD card and loading it to WebView

From Dev

Copying file from asset into sd card in android

From Dev

Error while deleting a file from SD card

Related Related

  1. 1

    Download image from firebase to external sd Card using url

  2. 2

    How to download a linux image, unzip it and write it to an SD card in one line?

  3. 3

    How to download a linux image, unzip it and write it to an SD card in one line?

  4. 4

    How to write a file in external sd card and not in device storage?

  5. 5

    Firebase download image from Storage directly

  6. 6

    Hide a file from SD card

  7. 7

    How to save and get path of image Cropped Android from sd card?

  8. 8

    How to load image from SD card using Picasso library

  9. 9

    How to use Cygwin to copy an image from an SD memory card

  10. 10

    How show progress bar while read file from SD card

  11. 11

    How to build an sd card image, without an sd card?

  12. 12

    Use DownloadManager to download files to real SD card, not to emulated storage

  13. 13

    Use DownloadManager to download files to real SD card, not to emulated storage

  14. 14

    Android: write bytes to image file on SD Card

  15. 15

    SD Card as Permanent Storage?

  16. 16

    download text file from firebase storage and displaying on a web page

  17. 17

    Open file from Firebase Storage in new table and not download

  18. 18

    How to bind image in angularjs from firebase storage

  19. 19

    How to send image in a sd card through bluetooth

  20. 20

    How to copy image to an existing directory on sd card?

  21. 21

    How to save transformed image to SD card

  22. 22

    Exception while reading file from SD Card

  23. 23

    Pick a file from an SD card using Intent

  24. 24

    Get path of Specific file from SD Card

  25. 25

    Arduino reading a database file from sd card

  26. 26

    Convert Video File from SD Card to audio

  27. 27

    Reading file from SD card and loading it to WebView

  28. 28

    Copying file from asset into sd card in android

  29. 29

    Error while deleting a file from SD card

HotTag

Archive