添加应用时删除了Firebase数据库 [英] Firebase database deleted when added app

查看:223
本文介绍了添加应用时删除了Firebase数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我正在构建一个将在Play商店中运行的应用程序,它可以将数据添加到Firebase(它无法读取它)。

Okay, so I am building an app that will go on the play store, it has the facility to add data to the Firebase (it cannot read it).

第二个应用程序将保留在我身边(它不会进入游戏商店)并且它用于读取数据。

Second app will remain with me, (it wont go on the play store) and it is used to read the data.

现在我做的是,让我们说第一个应用程序包名称为: com.example.write ,第二个应用程序包含 com.example.read

Now what I did was, lets say the first app has package name : com.example.write and the second has com.example.read.

所以我去了Firebase,创建了一个项目,使用包名 com.example.write 添加了一个应用程序并设置了我的第一个应用。工作完美,我可以添加数据到Firebase数据库,现在创建第二个应用程序,我创建了android工作室项目,使用包名称 com.example.read 和as两个应用程序使用相同的Firebase数据库,我在firebase中的同一个项目中添加了新的应用程序,包名称为 com.example.read 但是我注意到的是之前的数据库被删除,当我点击导航栏上的数据库按钮时,它为我提供了创建数据库的选项,当我这样做时,第一个应用程序崩溃(可能因为旧数据库被删除而无法正确添加数据) )。那么我该如何在两个应用程序上使用相同的数据库呢?

So I went to Firebase, created a project, added an application using the package name com.example.write and setup my first app. Working perfectly, I could add data to the Firebase database, now to create the second app, I created the android studio project, using the package name com.example.read and as both the apps use the same Firebase database, I added the new app in the same project in firebase, with package name com.example.read but then what I noticed was the previous database was deleted and when I hit the database button on the navigation bar, it gives me an option to create a database, when I do so, the first app crashes (probably because the old database was deleted to it could not add the data properly). So what should i do to use the same database on both the apps?

使用firebase的spark(免费)计划!

Using spark (free) plan of firebase!

推荐答案


那么我该如何在两个应用程序上使用相同的数据库呢?

So what should i do to use the same database on both the apps ?

要解决此问题,请打开< a href =https://console.firebase.google.com/ =nofollow noreferrer> Firebase控制台,选择您的项目,然后点击添加其他应用并选择将Firebase添加到您的Android应用

To solve this, open Firebase Console, select your project, then click on Add another app and select Add Firebase to your Android app.

提供新包名称的所有必要详细信息,在您的情况下 com.example.read ,然后下载再次将JSON文件添加到连接到此项目的Android应用程序的两者。就是这样!

Provide all the necessary details for the new package name, in your case com.example.read, then download the JSON file again and add it to both of your android apps that are connected to this project. That's it!

这篇关于添加应用时删除了Firebase数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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