firestore读取和写入另一个应用程序android [Kotlin]



我有两个应用程序第一个是卖方应用程序和第二个是买方应用程序。我已经开发了卖方应用程序,它有一些信息存储关于卖方和一些产品集合,我使用firebase Firestore数据库来存储信息。现在我正在开发第二个买家应用程序,我想在其中存储一些关于买家的信息,我也想在买家应用程序中显示存储的购买卖家应用程序的产品集合。所以,我完全糊涂了。

当我有一个Firebase时,我可以从卖方应用程序访问所有数据项目与卖方和买方的应用程序在该firebase项目。但我如何管理买方应用程序存储的数据。

所以,我想以某种方式买方应用程序有权卖方应用程序数据读取整个数据和更新只有某些数据(如卖方的审查)与另一个fireabse项目,其中我只能管理买方应用程序存储的数据。

我已经解决了这个问题,现在需要一些建议以下是Buyer App中的代码。

val option  = FirebaseOptions.Builder()
            .setProjectId("project-id-3564") //seller app project id
            .setApiKey("Api_key")// api key of seller app project
            .setApplicationId("1:1234567890")//app id for seller app project
            .build()
        val app = Firebase.initialize(this , option, "secondary")
        val firebase = FirebaseFirestore.getInstance(app)
        firebase.collection("collection").get().......

并且我必须更改卖方应用程序项目数据库规则的读写权限

match /{document=**} {
     allow read, write: if request.auth != null;
    }

match /{document=**} {
     allow read, write: if true;
    }

* *我再次得到permission denied error

不建议使用。那么现在我该怎么做呢许可

* *

最新更新