https://grokonez.com/android/firebase-storage-download-files-to-memory-local-file-android

Firebase Storage – Download Files to Memory, Local File | Android

In previous post, we had known the way to upload data. This tutorial shows you how to download Files to Memory, Local File with Firebase Cloud Storage.

Related Post:
Firebase Storage – Upload Data from Memory, Local File, Stream | Android

More Practice:
Firebase Storage – Get List of Files example – Image List | Android

I. How to download file

To use the Firebase Storage to download file, we need: - add Firebase to Android App & enable Firebase Auth - create a reference to the full path of the file, including the file name - download file using getBytes() for in-memory data, getFile() for local file.

To know way to add Firebase to Android App & enable Firebase Auth, please visit previous post:
Firebase Storage – Upload Data from Memory, Local File, Stream | Android

This tutorial bases on the code from that post, and continues with download methods.

1. Create a Reference


// From our app
StorageReference storageRef = storage.getReference();

// With an initial file path and name
StorageReference pathReference = storageRef.child(“images/javasampleapproach.jpg”);

// To a file from a Google Cloud Storage URI
StorageReference gsReference = storage.getReferenceFromUrl(“gs://javasampleapproach-storage.appspot.com/images/javasampleapproach.jpg”);

// From an HTTPS URL
StorageReference httpsReference = storage.getReferenceFromUrl(“https://firebasestorage.googleapis.com/v0/b/javasampleapproach-storage.appspot.com/o/images%2Fjavasampleapproach.jpg”);

More at:

https://grokonez.com/android/firebase-storage-download-files-to-memory-local-file-android

Firebase Storage – Download Files to Memory, Local File | Android

#firebase #storage #localfile #android

Firebase Storage - Download Files to Memory, Local File | Android » grokonez
3.25 GEEK