Firebase Real Time Database not showing existing Database but working fine - android

I am building an android application and I am facing some weird issues related to FIREBASE DATABASE.
I have created a firebase database and added some tables, fields and added some data, like;
Log in with phone authentications etc.
I can use this database with my android app, but I can't be able to see the database.
I have tried a lot to refresh again and again, but not working.
If someone is using firebase, then please login to the console. firebase and check if you can see it, might be, GOOGLE changes its UI (User Interface).
Help me, please!
It will be a great favor.

I think you are not selecting your project:
Check if that is your project, or change it.
If it's prompting you to create a database for that project, it is because that is not the project you are working on. You need to select the current project you are working on in order to see your database.

There are two options - 1. Realtime Database i.e. Firebase. 2. Cloud FireStore. You have to select 1 instaed of 2. See the image below

I was experiencing the same problem. I was worried that all the data might have been deleted. I just left the tab open and after few minutes the database and its children started showing. I think if your database contains a lot of data, it takes time to load the data.

You have to click on Create Database button and setup rules before you try to save data on database. Remember Your are only setting up rules here not giving any database name.

Related

Firebase real time DB persistence [duplicate]

I am trying to build a simple login user authentication Android application that uses Firebases Realtime Database but I am getting the error:
[Firebase Database connection was forcefully killed by the server. Will not attempt to reconnect. Reason: The database lives in a different region. Please change your database URL to https://vax-in-60807-default-rtdb.asia-southeast1.firebasedatabase.app]
I am currently using the Singapore(asia-southeast1) server since I live in the Philippines. Is this wrong? or Should I be using the US one? How do I change my Database URL?
It looks like the google-services.json file that you use doesn't contain the Realtime Database URL, probably because you downloaded it before the database was created. In such cases the SDK assumes that the database is in the US (the original region), and you get an error that there's a mismatch.
There are two possible solutions:
Download an updated google-services.json from the Firebase console, and add that to your Android app.
Specify the database URL in your code instead, like this: FirebaseDatabase.getInstance("https://vax-in-60807-default-rtdb.asia-southeast1.firebasedatabase.app")...
Both have the same result, so pick whichever one seems easiest to you.
It cat still not work after the accepted answer (as in my case). If so, try:
Clean Project
Rebuild Project
Invalidate Caches & Restarte
and run it again.
If you are a New Flutter User who followed the new firebase doc, run this command in the terminal. It will automatically update the firebase_options.dart file.
flutterfire configure
I faced the same problem and that's because when you set up the app, the google-service.json doesn't contain the firebase_url.
These problems faced you when configuring your set up manually, You can fix all that problems by using flutterfire, it will help you a lot and set up your app in a few steps.
see docs firebase
It looks like the google-services.json file that you use doesn't contain the Realtime Database URL, probably because you downloaded it before the database was created. In such cases, the SDK assumes that the database is in the US (the original region), and you get an error that there's a mismatch.
You can fix it either way.
After configuring the database service setup you have to download the new "GoogleService-Info.plist" file and replace the previous one.
or
You can manually set the key in your "GoogleService-Info.plist" file
<key>DATABASE_URL</key>
<string>https://<app-instance-default-rtdb>.asia-southeast1.firebasedatabase.app</string> '

Firebase Realtime Database connection killed: Different Region

I am trying to build a simple login user authentication Android application that uses Firebases Realtime Database but I am getting the error:
[Firebase Database connection was forcefully killed by the server. Will not attempt to reconnect. Reason: The database lives in a different region. Please change your database URL to https://vax-in-60807-default-rtdb.asia-southeast1.firebasedatabase.app]
I am currently using the Singapore(asia-southeast1) server since I live in the Philippines. Is this wrong? or Should I be using the US one? How do I change my Database URL?
It looks like the google-services.json file that you use doesn't contain the Realtime Database URL, probably because you downloaded it before the database was created. In such cases the SDK assumes that the database is in the US (the original region), and you get an error that there's a mismatch.
There are two possible solutions:
Download an updated google-services.json from the Firebase console, and add that to your Android app.
Specify the database URL in your code instead, like this: FirebaseDatabase.getInstance("https://vax-in-60807-default-rtdb.asia-southeast1.firebasedatabase.app")...
Both have the same result, so pick whichever one seems easiest to you.
It cat still not work after the accepted answer (as in my case). If so, try:
Clean Project
Rebuild Project
Invalidate Caches & Restarte
and run it again.
If you are a New Flutter User who followed the new firebase doc, run this command in the terminal. It will automatically update the firebase_options.dart file.
flutterfire configure
I faced the same problem and that's because when you set up the app, the google-service.json doesn't contain the firebase_url.
These problems faced you when configuring your set up manually, You can fix all that problems by using flutterfire, it will help you a lot and set up your app in a few steps.
see docs firebase
It looks like the google-services.json file that you use doesn't contain the Realtime Database URL, probably because you downloaded it before the database was created. In such cases, the SDK assumes that the database is in the US (the original region), and you get an error that there's a mismatch.
You can fix it either way.
After configuring the database service setup you have to download the new "GoogleService-Info.plist" file and replace the previous one.
or
You can manually set the key in your "GoogleService-Info.plist" file
<key>DATABASE_URL</key>
<string>https://<app-instance-default-rtdb>.asia-southeast1.firebasedatabase.app</string> '

How to Improve an App Performance that uses Internet to work ??? [WhatsApp Clone]

I am building an App that has same functionality as WhatsApp. I am using firebase(Online Mode) and Room(Offline Mode).
I want that my code should determine when to fetch the data from firebase and when the user is offline just store and show the data using Room Db and whenever the user goes online update in firebase.
Flow:
If Online:
Check if Database have changes if yes fetch data and store locally in Room.
Check if Room Db is changed if yes update UI. [UI should only get data from Room Db]
If Offline:
Store the data locally and change the UI instantly and whenever the user goes online update firebase.
If this is not the optimised solution in respect of App Performance. Please share your thoughts
You are trying to build whatsapp clone. You have to save datas to sqlite when user is online. And, when you are online then, you have to check the size of that person's information. If size changes it means someone messaged him or happened something to database. Then, you can change sqlite information. I think you are just looking for idea not source code. If you want to know source code. Then, implement your source code where you are having error.

How to keep firebase realtime database in sync with firebase storage, the standard approch to this problem of two nested queries?

How to keep firebase realtime database in sync with firebase storage? I am trying to store images in firebase storage.
The current scenario
a POJO (which contain 3 images placeholder link) is saved in the realtime database.
Then the 3 images are uploaded in firebase storage and on successful upload the respected placeholder links in the realtime database are updated.
Now the problem is that sometimes when the user deletes the project in between the POJO is deleted from firebase but the links are still updated.
Is there a better way of doing this ? or is there any standard approch? Thankyou for your time.
There is not a standard approach to this, and it can't be solved by simple configuration. You will have to get creative and implement something that meets your specific needs.
One thing you can do is use Cloud Functions triggers to mirror and delete data between the two products, so that one data in one is added, modified, or deleted, that change is reflected in the other product. It would take at least two triggers, one database trigger, and one storage trigger, to make sure changes in either product are mirrored to the other product. You might also need some additional process to remove or correct invalid data periodically, if that is a concern.

manage non local sqlite database in android

I have started working with databases lately, I was able to create a local database and manage it in my Android app. Now I want to move to higher level with it but I don't know how to do it.
The users in my app need to be able to modify the database, for example insert new data in it. When a user insert new data in the database I want other users to see this change in their copy of the database.
I understand that I will need to store that database on a server or something and synchronize it with the users.
Can anyone tell me the steps to do so?
You should perfom this task in steps.
First, make the local database, and use a system to know when/what changed.
I usually work with triggers myself, but any "mark" is enough to synchronize.
Then, you must make a replica of that database somewhere else. Realise that maintaining the databases is a process, any change in the structure of one database must be performed in all other as well.
Finally, you must implement a method to transfer the data.
So, for an example:
db_local the database in the device.
db_outside the database in the internet.
db_local.trigger -> onInsert
On the applications, check for internet, then connect to your server, then upload the same command to db_outside and run it...
In this step, you must handle connection issues, and if the SQL command was succesfully executed, you have replicated the database content.
Once you have the replicated database, inform a system (like google cloud messaging), that the database was changed, and have the other users pull the info.

Categories

Resources