Firebase database deleted when added app

旧城冷巷雨未停 提交于 2020-01-11 14:03:32

问题


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.

Now what I did was, lets say the first app has package name : com.example.write and the second has 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?

Using spark (free) plan of firebase!


回答1:


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

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

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!



来源:https://stackoverflow.com/questions/51769058/firebase-database-deleted-when-added-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!