Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.65 KB

File metadata and controls

38 lines (29 loc) · 1.65 KB

FirebaseUI for Android — Storage

Using FirebaseUI to download and display images

Firebase Storage provides secure file uploads and downloads for your Firebase apps, regardless of network quality. You can use it to store images, audio, video, or other user-generated content. Firebase Storage is backed by Google Cloud Storage, a powerful, simple, and cost-effective object storage service.

FirebaseUI provides bindings to download an image file stored in Firebase Storage from a StorageReference and display it using the popular Glide library. This technique allows you to get all of Glide's performance benefits while leveraging Firebase Storage's authenticated storage capabilities.

To load an image from a StorageReference, simply use the FirebaseImageLoader class:

// Reference to an image file in Firebase Storage
StorageReference storageReference = ...;

// ImageView in your Activity
ImageView imageView = ...;

// Load the image using Glide
Glide.with(this /* context */)
        .using(new FirebaseImageLoader())
        .load(storageReference)
        .into(imageView);

Images displayed using FirebaseImageLoader are cached by their path in Firebase Storage, so repeated loads will be fast and conserve bandwidth. For more information on caching in Glide, see this guide.