SlideShare a Scribd company logo
1 of 12
FIREBASE
STORAGE
FOR ANDROID.
By Prushni Jani
Why Firebase ?
 Build apps fast, without
managing infrastructure
 One console, with products
that work together
 Backed by Google, trusted by
top apps
Cloud Storage is built for app developers who need to store
and serve user-generated content, such as photos or videos.
FIREBASE STORAGE
How does it work?
 Firebase Cloud Storage stores your files (Images or
Videos) in a Google Cloud Storage bucket.
 These files can be accessible through both Firebase and
Google Cloud.
 So developers choose firebase storage so that the
applications will be more flexible and user can upload
and download files from mobile devices. Developers
use Firebase SDKs for this.
FIREBASE STORAGE
How to implement ?
Integrate the Firebase
SDKs for Cloud Storage.
Create a Reference
Upload/Download
FIREBASE STORAGE
ImageView
Choose Upload
Lets create a project for more understanding.
For example, we want to select an image from
app and upload to Storage
FIREBASE STORAGE
1. Configure
your Project
2. Add
Reference
points
3. Code For
Uploading File
Steps for implementation :
FIREBASE STORAGE
STEP 1 : Configure your Project
1. Click on TOOLS and select FIREBASE.
2. Click on Storage. => Click on Upload and
Download
a) Click on Connect to Firebase.
b) Click on Add Firebase Dependency.
FIREBASE STORAGE
For Uploading image, we need to
add image view and two buttons.
FIREBASE STORAGE
STEP 2 : References point to files
In MainActivity.java, add
private StorageReference mStorageRef;
mStorageRef = FirebaseStorage.getInstance().getReference();
FIREBASE STORAGE
STEP 3 : Upload a File
Uri file = Uri.fromFile(new File("path/to/images/codekaksha.jpg"));
StorageReference riversRef = storageRef.child("images/rivers.jpg");
riversRef.putFile(file)
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// Get a URL to the uploaded content
Uri downloadUrl = taskSnapshot.getDownloadUrl();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle unsuccessful uploads
// ...
}
});
Add this code in onClickListener of Upload Button.
FIREBASE STORAGE
You can view the files in your storage bucket in the Firebase Console.
Click on STORAGE . Go to Rules, and change the rules to :
allow read, write: if true;
Your
Uploaded
File
FIREBASE STORAGE
REFERENCES :
• Add Firebase to your Project
https://firebase.google.com/docs/android/setup
• Firebase UI
https://github.com/firebase/FirebaseUI-Android
FIREBASE STORAGE

More Related Content

Similar to Android Firebase Storage

Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
Sriyank Siddhartha
 

Similar to Android Firebase Storage (20)

Firebase Auth Tutorial
Firebase Auth TutorialFirebase Auth Tutorial
Firebase Auth Tutorial
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with Firebase
 
Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...
Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...
Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...
 
Spring hibernate tutorial
Spring hibernate tutorialSpring hibernate tutorial
Spring hibernate tutorial
 
Lecture 3 React Native with Database.pptx
Lecture 3 React Native with Database.pptxLecture 3 React Native with Database.pptx
Lecture 3 React Native with Database.pptx
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase Integration
 
Firebase overview
Firebase overviewFirebase overview
Firebase overview
 
Lecture 11 Firebase overview
Lecture 11 Firebase overviewLecture 11 Firebase overview
Lecture 11 Firebase overview
 
What is new in Firebase?
What is new in Firebase?What is new in Firebase?
What is new in Firebase?
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
 
Google Firebase presentation - English
Google Firebase presentation - EnglishGoogle Firebase presentation - English
Google Firebase presentation - English
 
InitiateAEv2.pdf
InitiateAEv2.pdfInitiateAEv2.pdf
InitiateAEv2.pdf
 
Cordova Tutorial
Cordova TutorialCordova Tutorial
Cordova Tutorial
 
Devfest SouthWest, Nigeria - Firebase
Devfest SouthWest, Nigeria - FirebaseDevfest SouthWest, Nigeria - Firebase
Devfest SouthWest, Nigeria - Firebase
 
Cloud Messaging Flutter
Cloud Messaging FlutterCloud Messaging Flutter
Cloud Messaging Flutter
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
Deploying Code In SharePoint
Deploying Code In SharePointDeploying Code In SharePoint
Deploying Code In SharePoint
 
Features everywhere
Features everywhere Features everywhere
Features everywhere
 
SPSNL - SPFx Deployment
SPSNL - SPFx DeploymentSPSNL - SPFx Deployment
SPSNL - SPFx Deployment
 
Firebase .pptx
Firebase .pptxFirebase .pptx
Firebase .pptx
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 

Recently uploaded (20)

Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 

Android Firebase Storage

  • 2. Why Firebase ?  Build apps fast, without managing infrastructure  One console, with products that work together  Backed by Google, trusted by top apps Cloud Storage is built for app developers who need to store and serve user-generated content, such as photos or videos. FIREBASE STORAGE
  • 3. How does it work?  Firebase Cloud Storage stores your files (Images or Videos) in a Google Cloud Storage bucket.  These files can be accessible through both Firebase and Google Cloud.  So developers choose firebase storage so that the applications will be more flexible and user can upload and download files from mobile devices. Developers use Firebase SDKs for this. FIREBASE STORAGE
  • 4. How to implement ? Integrate the Firebase SDKs for Cloud Storage. Create a Reference Upload/Download FIREBASE STORAGE
  • 5. ImageView Choose Upload Lets create a project for more understanding. For example, we want to select an image from app and upload to Storage FIREBASE STORAGE
  • 6. 1. Configure your Project 2. Add Reference points 3. Code For Uploading File Steps for implementation : FIREBASE STORAGE
  • 7. STEP 1 : Configure your Project 1. Click on TOOLS and select FIREBASE. 2. Click on Storage. => Click on Upload and Download a) Click on Connect to Firebase. b) Click on Add Firebase Dependency. FIREBASE STORAGE
  • 8. For Uploading image, we need to add image view and two buttons. FIREBASE STORAGE
  • 9. STEP 2 : References point to files In MainActivity.java, add private StorageReference mStorageRef; mStorageRef = FirebaseStorage.getInstance().getReference(); FIREBASE STORAGE
  • 10. STEP 3 : Upload a File Uri file = Uri.fromFile(new File("path/to/images/codekaksha.jpg")); StorageReference riversRef = storageRef.child("images/rivers.jpg"); riversRef.putFile(file) .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // Get a URL to the uploaded content Uri downloadUrl = taskSnapshot.getDownloadUrl(); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle unsuccessful uploads // ... } }); Add this code in onClickListener of Upload Button. FIREBASE STORAGE
  • 11. You can view the files in your storage bucket in the Firebase Console. Click on STORAGE . Go to Rules, and change the rules to : allow read, write: if true; Your Uploaded File FIREBASE STORAGE
  • 12. REFERENCES : • Add Firebase to your Project https://firebase.google.com/docs/android/setup • Firebase UI https://github.com/firebase/FirebaseUI-Android FIREBASE STORAGE