有没有办法为具有不同包名称的 2 个应用程序使用 1 个 Firebase 数据库? [英] Is there a way to have 1 Firebase database for 2 apps with different package names?

查看:16
本文介绍了有没有办法为具有不同包名称的 2 个应用程序使用 1 个 Firebase 数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个应用程序(不同的包名称),可满足 2 个不同的用户组的需求.一个将数据放入数据库,另一个检索它.因此,我只需要两个应用程序的 1 个 firebase 数据库.据我所知,Firebase 只允许 1 个数据库用于 1 个包名称.有没有办法解决这个问题并为 2 个应用程序提供 1 个 Firebase 数据库?

I have 2 applications(different package names) catering to 2 different user groups. One puts data into database and the other retrieves it. Therefore I want only 1 firebase database for both the apps. Firebase allows only 1 database for 1 package name as far as I know. Is there a way to solve this problem and have 1 Firebase database for 2 apps?

推荐答案

是的,可以使用 Firebase 控制台.每个项目只能获得一个数据库,但只需在控制台中添加它们,您就可以为每个项目拥有多个应用.它们不需要具有相同的包名称或签名密钥.

Yes this is possible using the Firebase console. You only get one database per project but you can have many apps per project just by adding them in the console. They don't need to have the same package name or signing key.

如果您出于某种原因不能将它们都添加到同一个项目中,则必须在客户端代码中手动配置至少一个应用程序.因此,无需使用 google-services.json 文件进行配置,您可以手动调用 FirebaseApp.initializeApp() 并填写信息,以便两个应用程序都在进行相同的对话Firebase 项目.

If you have some reason why you can't add them both to the same project, you will have to configure at least one of the apps manually in client side code. So rather than using the google-services.json file for configuration, you can call FirebaseApp.initializeApp() manually and fill in the information so both apps are talking to the same Firebase project.

这篇关于有没有办法为具有不同包名称的 2 个应用程序使用 1 个 Firebase 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆