Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i store to different storage buckets using Firebase Storage

Is there a way to communicate/store data to another project/application using Firebase Storage? How can I initialize my application to call another Firebase Storage Bucket?

like image 887
DreamBigAlvin Avatar asked Jul 20 '16 05:07

DreamBigAlvin


People also ask

How much data can we store in Firebase Storage?

Quota for Hosting storage Storage for your Hosting content is at no cost up to 10 GB. If you are not on the Blaze plan, and you reach the 10 GB limit of no-cost Hosting storage, you won't be able to deploy new content to your sites.

Is Firebase Storage same as Google Cloud Storage?

The new Firebase Storage is powered by Google Cloud Storage, giving it massive scalability and allowing stored files to be easily accessed by other projects running on Google Cloud Platform. Firebase now uses the same underlying account system as GCP, which means you can use any GCP product with your Firebase app.

What platform is used to store data in Firebase?

Firebase Realtime Database is a NoSQL cloud database that is used to store and sync the data. The data from the database can be synced at a time across all the clients such as android, web as well as IOS. The data in the database is stored in the JSON format and it updates in real-time with every connected client.

How do I add Storage to Firebase?

Add Firebase to your Android project | Firebase To do so, go to your app's Firebase Console and navigate to the Storage option. From there, click on “Get Started” and follow the on-screen instructions.


2 Answers

Referring to this More than one Firebase Database i just tried to configure the initialization of the Firebase Storage by using

   FirebaseOptions options = new FirebaseOptions.Builder()
            .setApiKey("AI...j0")
            .setApplicationId("1:5...e0")
            .setDatabaseUrl("https://myapp.firebaseio.com")
            .build();
    FirebaseApp secondApp = FirebaseApp.initializeApp(getApplicationContext(), options, "second app");
    //storage
    FirebaseStorage storage = FirebaseStorage.getInstance(secondApp);
    StorageReference storageRef = storage.getReferenceFromUrl("gs://.......");
like image 65
DreamBigAlvin Avatar answered Sep 27 '22 18:09

DreamBigAlvin


While DreamBigAlvin's workaround still works, a simpler way is now built-in into the Firebase SDK:

StorageReference storageReference = 
    FirebaseStorage.getInstance("gs://my-custom-bucket")
                   .getReference();
like image 41
Incinerator Avatar answered Sep 27 '22 16:09

Incinerator