我如何使用 Firebase Storage 存储到不同的存储桶
How can i store to different storage buckets using Firebase Storage
有没有办法使用 Firebase 存储将数据 communicate/store 传输到另一个 project/application?如何初始化我的应用程序以调用另一个 Firebase 存储桶?
参考这个 我只是尝试使用
配置 Firebase 存储的初始化
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://.......");
虽然 DreamBigAlvin 的解决方法仍然有效,但现在更简单的方法是 built-in into the Firebase SDK:
StorageReference storageReference =
FirebaseStorage.getInstance("gs://my-custom-bucket")
.getReference();
更新:2019
现在的方法是:
StorageReference reference =
FirebaseStorage(storageBucket: "gs://my-bucket").ref();
有没有办法使用 Firebase 存储将数据 communicate/store 传输到另一个 project/application?如何初始化我的应用程序以调用另一个 Firebase 存储桶?
参考这个
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://.......");
虽然 DreamBigAlvin 的解决方法仍然有效,但现在更简单的方法是 built-in into the Firebase SDK:
StorageReference storageReference =
FirebaseStorage.getInstance("gs://my-custom-bucket")
.getReference();
更新:2019
现在的方法是:
StorageReference reference =
FirebaseStorage(storageBucket: "gs://my-bucket").ref();