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

https://grokonez.com/android/firebase-storage-upload-file-from-memory-local-stream-android

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

Firebase Cloud Storage helps us upload and share rich content data. Data is stored in a Google Cloud Storage bucket. With Firebase, we can perform robust operations (download/upload) regardless of network quality with strong security (Cloud Storage integrates with Firebase Authentication) and high scalability.

In this tutorial, we're gonna look at ways to upload data from Memory, Local file, Stream in an Android App using Firebase Storage.

More practice:

I. How to upload file

To use the Firebase Storage to upload data, we need:

  • add Firebase to Android App & enable Firebase Auth
  • create a reference to the full path of the file, including the file name
  • upload data using putBytes() for in-memory data, putStream() for stream data, putFile() for local file.

    0. Add Firebase to Android App

    0.1 Create Firebase Project and Add Firebase Config file

    Follow this guide to create Firebase Project and generate google-services.json file and move it into your Android App root directory. You don't need to get SHA-1 Key in this example.

    0.2 Add dependencies

  • build.gradle (project-level):
    
    buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0'
    }
    }
  • build.gradle (App-level):
    
    dependencies {
    // ...
    compile 'com.google.firebase:firebase-auth:11.0.2'
    compile 'com.google.firebase:firebase-storage:11.0.2'
    }

apply plugin: 'com.google.gms.google-services'

1. Enable Firebase Auth

By default, only authenticated users can read or write data, so we need Firebase Authentication for next step.
Go to Your Firebase Project Console -> Authentication -> SIGN-IN METHOD -> Enable Email/Password.

https://grokonez.com/android/firebase-storage-upload-file-from-memory-local-stream-android

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

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

451 bài viết.
79 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 5 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 5 tháng trước
1 0
Bài viết liên quan
White
16 1
Chào các bạn, trong chuỗi nghiên cứu của mình về Blockchain, có một bài viết khá thú vị về Database mà mình nghĩ nên chia sẽ ở đây, mong nhận đc nh...
Phuoc-Thanh Do viết 2 năm trước
16 1
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
451 bài viết.
79 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!