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?
Asked
Active
Viewed 3,063 times
5
-
I don't think its possible – APP Bird Jul 20 '16 at 05:48
3 Answers
6
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://.......");

Community
- 1
- 1

DreamBigAlvin
- 884
- 3
- 13
- 35
-
Good find! Using two projects is indeed a way to write files to two buckets. Within a single project, Firebase Storage will always refer to a single bucket. – Frank van Puffelen Jul 20 '16 at 14:28
2
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();

Incinerator
- 2,589
- 3
- 23
- 30
1
Update: 2019
According to https://pub.dartlang.org/documentation/firebase_storage/latest/firebase_storage/FirebaseStorage-class.html
The method is now:
StorageReference reference =
FirebaseStorage(storageBucket: "gs://my-bucket").ref();

Théo Champion
- 1,701
- 1
- 21
- 46