Register as Android app and in Unity Player Setting and get the package name and paste it here. For App nick name give it anything of your choice. Click on Register.
Click Next.
Download the SDK and press Next -> Continue to Console.
Now open the terminal and type keytool -list -keystore
On firebase console, Settings -> Project Settings -> Your Apps and Add fingerprint.
Under Build panel, click on Realtime Database -> Create Database.
Choose (us-central1) for Database Location and Start in Test Mode and the click Enable.
Move to Settings -> Project Settings -> Your Apps and download the google-services.json and SDK.
Open the Unity project and import packages:
Import google-services.json file under Assets folder.
Import Firebase.Database package from SDK. Import Package -> Custom Package -> and loacte the file under the download SDK zip (You need to unzip it beforehand)
Import it and if it asks to download some dependency enable it and let it setup the stage for you.
Make an empty game object and assign it a script (Say: realtime) with code.
Open UI -> Button. Under Inspector Panel of Button OnClick press on + and then drag and drop the created empty game object above and under function select realtime -> update_value.
Play the game and click on button you'll see the values changing on Realtime Database console over Firebase.
Visit Docs to learn other ways to send and receive data over firebase.
Incase an error occurs(Can't make Firebase App etc) try downloading the google-services.json again(Step 14) and replacing it with old file under Assets folder.