Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Firebase Real-time Database Not Working as everything is set correctly

I'm working on an android application, i'm trying to upload my data into the firebase Realtime Database , but it is not showing up there everything is set correctly, all dependencies are set correctly, application is working properly, there are no errors!. but the problem is data is not getting updated into the Realtime database.

enter image description here

buttonC.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            FirebaseDatabase database = FirebaseDatabase.getInstance();
            DatabaseReference myRef = database.getReference("message");

            myRef.setValue("Hello, World!");

        }
    });
like image 564
Pzd Mubasher Avatar asked Feb 02 '26 03:02

Pzd Mubasher


1 Answers

firebaser here

If you downloaded the google-services.json before you created the database, the SDK won't be able to determine the correct database URL - since your database instance is not in the default region.

You have two options to fix it in that case:

  1. You can specify the full database URL in the call to getInstance() like this: FirebaseDatabase.getInstance("your database URL").getReference()
  2. You can download an updated google-services.json after you created the database, and make sure you app uses that file.

It's pretty easy to miss this condition right now, as the relevant warning is logged as a debug message. We're working on surfacing the message more explicitly, but in the meantime the above should also work.

like image 169
Frank van Puffelen Avatar answered Feb 03 '26 17:02

Frank van Puffelen