有没有办法使用Firebase存储将数据传输/存储到另一个项目/应用程序?如何初始化我的应用程序以调用另一个Firebase存储桶?
答案 0 :(得分:6)
参考此https://www.polymer-project.org/1.0/docs/devguide/local-dom我刚尝试使用
配置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://.......");
答案 1 :(得分:2)
虽然DreamBigAlvin的解决方法仍然有效,但现在更简单的方法built-in into the Firebase SDK:
StorageReference storageReference =
FirebaseStorage.getInstance("gs://my-custom-bucket")
.getReference();
答案 2 :(得分:0)
现在的方法是:
StorageReference reference =
FirebaseStorage(storageBucket: "gs://my-bucket").ref();