简体   繁体   English

如何将Firebase Android用于多个ID应用程序

[英]how use firebase android for multiple id application

I have an application that is different for each user, id application is different for each user, so idApplication is dynamic. 我有一个对于每个用户而言都不同的应用程序,对于每个用户而言,id应用程序也不同,所以idApplication是动态的。 My problem is that json retrieved from firebase is linked to a single application id. 我的问题是从firebase检索的json链接到单个应用程序ID。 How can I use one file json for all the applications I generate dynamically? 如何为动态生成的所有应用程序使用一个文件json?

_______édit ____ _______édit____

I don't know thé application id, this application id is modified on a filé jenkins.properties on my project Android, and when jenkins générate New apk it do it with thé New id 我不知道应用程序ID,此应用程序ID在我的项目Android上的filéjenkins.properties上进行了修改,当jenkinsgénérateNew apk时,它会使用New id

Instead of relying on google-services.json and associated gradle plugin you can dynamically create FirebaseApp using something like following (I have this in dagger module) 无需依赖google-services.json和关联的gradle插件,您可以使用以下代码动态创建FirebaseApp (我在dagger模块中拥有此功能)

    FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
            .setApiKey(apiKey)
            .setApplicationId(someApplicationId)
            .setDatabaseUrl(databaseUrl)
            .setStorageBucket(storageBucket)
            .build();

    firebaseApp = FirebaseApp.initializeApp(context, firebaseOptions, "MyApp");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM