Firebase Database | A Guide for Beginners

Hi, Koders!

I observed that there were many queries on Firebase Database even me ! but eventually after trials and errors I solved the problem I had posted a solution to a Koder who had the same issue but I thought to make a more comprehensive guide on Firebase for begginers.
So lets get started!

Lets understand the blocks

The below warning is because there is no blocks associated with it.

Firebase Database Data Changed

This is an event triggered when the data changes in firebase, for example when you newly store a value to specific tag, the value is the data which is changes because before there was no data and now you have added a data thus the data changes. When this block is triggered it gives you the tag in which the data changes and the value of it.

Firebase Database Firebase Error

This is an event triggered when the Firebase gets an error while communicating. It also gives the error message from which the Firebase got Error.

Firebase Database got Value

This is an event triggered when the Data is called from firebase and this event is only triggered when the Firebase Get Value block is added. The firebase then gets the value of the tags which was called by the get value it also gives the tags and their values.

Firebase Database Got Taglist

This is an event triggered when you call get tag list block.

Coming over to call Blocks of Firebase Database

Firebase Database Call Append Value

This is a call block to append a value to a specific tag, you should set the tag to be a block from text an the value can be anything, it can be either list or number or text etc. In the Call Append Value Block the Value is being added as lists it means that the previous value will not be removed, the value added will just add another item to the whole list. When this call successes When Firebase Database Data Changed Block is triggered.

This block has a problem


which I will tell the solution as we go on in this post.

Firebase Database Call Clear Tag

This a call block which clears all the value of the specific tag either it is a list or text or number, it will just clear the whole tag. The Input should be a Text for the tag. When this call successes When Firebase Database Data Changed Block is triggered.

Firebase Database Call Get Tag List

This a call block. Its get values of all the tags in their Firebase Token and URL. When this call successes When Firebase Database Tag List block is triggered.
I highly not recommend you to use this block as it costs a lot of bandwidth and your Firebase Database may stop due to over limit of the bandwidth.

Firebase Database Call Get Value
This is a Call Block. It only gets the value of Specific tag. The tag should be any block from text. When this call successes When Firebase Database Got Value block is triggered. When there is no value in the tag you can input anything in the value if tag not there.
Use this block carefully as it costs bandwidth for each item you want to get value if you have created Firebase Realtime Database by your own.

Firebase Database Call Go Offline
This is a Call Block, it makes the Firebase connection to the device go offline, now we can’t store or append any values to the tag as the connection is offline, it works the opposite of the Block Call Go Online.

Firebase Database Call Go Online
This is a Call Block, it makes the Firebase connection to the device go online, now we can store or append any values to the tag as the connection is online, it works the opposite of the Block Call Go Online.

Firebase Database Call Remove First
This is a call block , it removes the first item of the particular tag. The tag should be in text. When this call successes When Firebase Database Data Changed Block is triggered.

Firebase Database Call Store Value
This is a call block to store a value to a specific tag, you should set the tag to be a block from text an the value can be anything, it can be either list or number or text etc. In the Call Store Value Block the Value is being stored meaning the previous value is being removed and the new valued is being added it can be said as the value is being replaced. When this call successes When Firebase Database Data Changed Block is triggered.

Now I hope all of the Koders understood the difference between Append Value and Store Value Block.

Lastly of the Call Block Firebase Database Unauthenicate.
Firebase Database Unauthenicate
This block is not so important but just for information, it clears the internal cache of firebase, it may be needed in companion. More Information is available in Kodular Docs.

Coming over to set Blocks of Firebase Database

The Errors are because there are no blocks associated with it.

Firebase Database Set Firebase Token
The Firebase Token is generally a WEB API provided by Firebase, Kodular also provides the WEB API but I recommend to use your own WEB API which I will Tell in this Post. This block is helpful if you want to set the Firebase Token from blocks or you want to change it while using the app.

Firebase Database Set Firebase URL
The Firebase URL is generally a Database URL provided by Firebase, Kodular also provides the Database URL but I recommend to use your own Database URL which I will Tell in this Post. This block is helpful if you want to set the Firebase URL from blocks or you want to change it while using the app.

The Firebase Token and URL is necessary to identify your Database created using Firebase.

Firebase Database Set Project Bucket
The Firebase Project Bucket is a Bucket in Firebase which contains the Tags, we can change the Firebase Project Bucket to create a new list of Tags. This block is helpful if you want to set the Firebase Project Bucket from blocks or you want to change it while using the app.

Coming over to get Blocks of Firebase Database

Firebase Database get Firebase Token
Its gets the Firebase Token for Firebase Database

Firebase Database get Firebase URL
Its gets the Firebase URL for Firebase Database

Firebase Database get Project Bucket
Its gets the Firebase Project Bucket for Firebase Database

Lastly Firebase Database Block
Firebase Database Component Blocks
This is just a Component block representing Firebase Database

Creating and Connecting our own Database to Firebase

As I have promised you to Create a Database, now we are going to make it, before continuing we will see the advantages and disadvantages of using our own Database

Advantages

  1. When we create our own Database the Data will be secured with us all the values will be with us in the Database and we can view, edit and delete it.
  2. It also solves 50% of the issue of the Append Error
  3. The Database by us has more storage comparative to Kodular, when the Data exceeds the Firebase will prompt you to upgrade the plan.

Disadvantages

  1. Creating a Database is not an easy task, it needs time and patience.
  2. If you are testing your app I suggest you to use the Database provided by Kodular as it takes time.

Lets create a Database

Before doing these Steps make sure you have a Google Account if not Sign Up as Firebase is provided by Google.

Step 1
Lets go to Firebase

Step 2
Click on Get Started, if you haven’t logged in to Google Account, you will be redirected to Sign In to Google Account Page else you will be redirected to Firebase Console.
Creating and Connecting our own Database to Firebase

Step 3
Add a Project to the Firebase Console
Creating and Connecting our own Database to Firebase

Step 4
Enter a Project Name and press Continue

Step 5
You can Allow Google Analytics in your Firebase Project

Step 6
You can Select your Default Account or Create a new Account
Creating and Connecting our own Database to Firebase

Step 7
After your Project is created, click on Continue
Creating and Connecting our own Database to Firebase

Step 8
On the Left Panel, next to Project Overview, Click on the Settings Icon, and then click on Project Settings.

Step 9
Copy the Web API and Paste it on Firebase Token
Creating and Connecting our own Database to Firebase

Step 10
Click on Realtime Database

Step 11
Click on Create Database

Step 12
Enable in the Locked mode

Step 13
You may choose the Location of the Project Bucket or Firebase may not prompt you.

Step 14
Click on the Rules Panel
Creating and Connecting our own Database to Firebase

Step 15
We need to edit the rules the current rules says that Firebase will not let the device to store or retrieve the data so, set the rules as follows bellow

{
  "rules": {
    ".read": true,
    ".write": true
  }
}

Step 16
Click on Publish
Creating and Connecting our own Database to Firebase
Now Firebase will allow users
To Store or Append - write
Retrieve - Read

You may now get a warning saying that
“Your security rules are defined as public, so anyone can steal, modify, or delete data in your database”
This is because we have now let the users have the full control over Database but they will have the control only if we give them in the app.

Step 17
Go back to the Data
Creating and Connecting our own Database to Firebase

Step 18
Over there copy the link,


And Paste it in the Firebase URL is the Designer.

Step 19
Enjoy, we have created and connected our Database to our App

Now all the Data is in your Project and you can control them and we have solved 50% of the issue of Firebase Append Error.

Structure of the Firebase Database

Whenever the Data Changes, the new value is appeared as green text and goes of.
image

Project Name
You may see that the project name is different from the project name you had given, that’s because people from world wide may have used same project names, thus firebase just edits a part of the project name but your project name would not change only the firebase database project name would change.

Project Bucket
Project Bucket contains all the tags, you can name the project bucket either in the designer or in the blocks.

Tag
The Tag contains the value, when the tag is called the firebase gets the value of that tag, tags are called as name in firebase.

Value
The value is thing which everyone knows, its a basic item.

Its time to solve the Append Error, just set the Blocks as given below
Solving the Append Error
Solving the Append Error
Solving the Append Error

These blocks means that
When the Screen starts the firebase gets the value of a specific tag .
After the Firebase gets the value it checks the tag, if its the correct tag then it will check its value and if the value is empty it stores an empty list.
Now when button is clicked it will append the value as already the value has been stored thus previous value empty error will not appear.

You are done, now you can append the value without any errors

Hope this guide was useful to all the Koders :slightly_smiling_face:

If you have any queries or errors or any more things to be added please let me know,

Please don’t flag this post, the users may copy the Link and Token but I will make sure that I will Private this project so now the users cannot Store or append or Retrieve the Data.

How was the Guide

  • Good
  • Moderate
  • Bad

0 voters

Date

Created on 2020-10-22T18:30:00Z
Last Updated on 2020-10-22T18:30:00Z

40 Likes
Firebase data base Problem
List view Blocks
Get value from different device?
When app opened for 1st time show a screen, else show a different screen
Firebase add file error
How to get value in firebase database
Trial application
How to retrieve data from firebase
How to get values from :firebase: Database and show them in card view?
Connect Firebase Database With Variable
Is it possible to make 1 to 1 chat app in kodular
Need An Interface / Screen Which Show Data From Firebase In A list view with live updates
Firebase Storage | A Guide for Beginners
How to add links
How can i remove "\" and \"" in firebase?
How to show fire base date in app
Firebase & listview Help
How to make a Profile Screen? (The Profile Screen and The Registration Screen is in Separated Screen)
Google Maps Marker
Firebase Function
My firebase can't update my local list variable
How to make a Profile Screen? (The Profile Screen and The Registration Screen is in Separated Screen)
Access a specific tag within Realtime Firebase
Report with firebase
Connect to Firebase
Issue with Firebase and uploading messages
How to make app like facebook or twitter posts
Where is the project bucket in Firebase Storage
Save data in phone
[GUIDE] Chat Application With Firebase (Advanced)
Saving data in firebase
How to create 'Order History' screen
I need help plz guide me
How to set text in text block using firebase or airtable
Could anyone please help me how to solve the Firebase error the previous value is empty?
I have exported app and downloaded app on my device [mobile] but
FirebaseError For a custom firebase host you must first set your authentication server before using authentication features!
Forgot password feature bugs - debugging
How to set text in text block using firebase or airtable
Firebase Database help needed
Firebase list got value
Firebase Error: "Previous value was empty"
How Can I add Append values in list view
List always resets
Click to Chat - Group Chat Aia
How to get data from firebase or airtable in particular label
Firebase - How to remove braces and quotes?
Firebase "previous value was empty "
Firebase get data
Kodular not connect my firebase
FirebaseError | Previous value was empty
How to create this block?
Biodata save, update, delete
Firebase store and got value problem
Have some issue storing datas in db
Staff profile app
Firebase cloud database
Send massage whatsapps help
Error from companion: for a custom firebase host you must first set your authentication server before using authentication features!
Add an item to the list in firebase
I am getting error in my application please help
Previous Value was empty
Is it necessary to use the Firebase SDK in my application?
Need help for store image to firebase storage
Why Firebase Runtime Error {Empty String}
Kodular blocks to display text when firebase data changes
Withdraw history using dynamic components & firebase database
linking my app with firebase steps
How to do that - user1 do any information user2,user3 never see
Firebase not adding the new data with the previous data
Hello, i want to replace firebase value yes to no and no to yes how can i do
Add value to Firebase list
Creating Folders and Subfolders in Firebase Database
Kodular don't care about users application
Firebase false Rule help
I pay $ 5 to help me connect my AIA with my Firebase Database.
No error notice occurs , But don't showing realtime data in my app using firebase database
How can I display databases from Firebase to ColinTreeListView?
Remove entry from firebase
Does FireBase not accept a Caption as (tag)?
How to make a online learning application?
Error when appending value to specific Tag in Firebase
Firebase DB Append Value
Kodular / Firebase Error
No data writing in firebase
Retrieve value from firebase tags
Rental system that depends on date, start time, end time and type of car
vvhvhhvI want to fuyfyufyudo the same design for the n
How can I pull this data from Firebase
Help Making Cart Page
Unable to append to a list in firebase
Firebase File Config Error
Tutorial reques

Congratulations ! :clap:t2:
Great job !
It will be very useful!

1 Like

This is excellent work.

I am working on a chat app at the moment and will be using Firebase. I’m having some trouble with it and this guide has answered some of my questions. I still have some other Firebase issues to address but they can wait for now.

Nice & Detailed Guide !
This is a Example of a Perfect Guide :smile:

2 Likes

Very useful!

1 Like

Thanks @Rogerio_Rios, @Romnigames, @themaayur, @WatermelonIce for your compliments :slightly_smiling_face:

3 Likes

Nice guide. :clap:
Very detailed.
Keep it up.

Anyone know that how to put a dictionary to a tag?
It is saving as a string instead of a JSON object.

1 Like

You can use loops,
For each *key* and *value* in dictionary
Store value; tag = *key*, value To Store = *value*

** is a variable

1 Like

Does this method solve the problem that FireBase does not accept a Caption as a tag?

When I create this logic, everything works perfectly. FireBase gives me an expected logical value.

blocks (6)

But when I use a Logic where the tag varies according to the user’s wishes, he returns an ERROR.

blocks (5)

The System does not see this legend, which is variable, as something logically correct. How can I solve this problem?

Thanks in advance.

Sometimes it works perfectly, but sometimes it doesn’t. (In the specific case Legend = “A”).

@heliocesar84 Yes, this will solve your problem
One of the section of the guide shows how to solve this problem.

Again, providing the details for ready reference

You have to look into Creating and Connecting Database and

have to see the last solution which is solving the append error in order to solve.

As far as I know, firebase tags are not Case-Sensitive.

If you have any Issues please let me know!

1 Like

Can I make this change?

Thank you for your concern.

blocks (8)

blocks (9)

If you want to Store the value then don’t create an empty list; but if you want to append then Store value of empty list and also remember to create a Database.

1 Like

Unfortunately I still have problems.

FireBase does not accept the logic of having a Legend as a Tag, even if the Tag reads a text with the desired tag.

blocks (6)

blocks (5)

The System does not recognize these two configurations as the same. Can I handle this Legend so that the two settings are the same?

Hello @heliocesar84,
Can you provide the AIA file,
And for appending don’t add make a list block, just add the text because text is saved as a list item while appending a data.

1 Like

Sure. I’ll send to you

1 Like

I am attaching value to each tag and I have been successful so far. Perhaps that is the reason for the ERROR.

1 Like

In my firebase console, there is no web api key to use as token. Any help please.

image

Have you registered for Android?
The guide didn’t mention that.

However I’m not sure if that’s the case.