Welcome to Learn Web my friends. Today we are going to learn about how to retrieve and store data from user in firebase database. This will be surely very exciting and useful for you guys. So, here we start our tutorial on "How to store data of user in Firebase in Kodular?"
How to store data of user in Firebase in Kodular?
1. What is Firebase?
I think you guys may have listened about Firebase but if not, then don't worry this isn't any rocket science you will easily learn "How to store and retrieve data of user in Firebase?". Firstly I want to tell you about What is Firebase Database? So, firebase is a cloud storage platform provided by google to store and retrieve data and Firebase also provide many other services that we will learn in our next tutorials. Today we are going to talk about "How to use Firebase Database in Kodular?"
2. What is Firebase database in Kodular?
Now I would like to tell you what is Firebase database and what we are going to Learn today. Simply Firebase database is same as we store data in Kodular Tiny DB. We can save string with tags to identify them but here we store data online in cloud storage. That's why we get some advantage to use Firebase database over Tiny DB that are given below:
1. User can save data from any device to his/her account.
2. User can also fetch data even after clearing data or uninstalling app.
3. We can easily identify user data.
4. Data is always most safe than saved in device.
3. What do we need to use Firebase Database?
You will be very happy to listen that Firebase Database is a completely Free service. We are thankful to google for this to allow us to use Firebase for free. So, you just need a Firebase Console account to use Firebase Database. You can Sign up for Firebase Console account from here
Go to Firebase's official Website and Click on the "Go to Console" Button on the Right Corner.
1. Now, you will see Firebase asking you to name your projects. So, just enter name of your project and check the terms and conditions and then proceed ahead.
2. Now follow the next steps shown to create your project.
Once you have created your project in Firebase successfully then open your project in Kodular Creator. Now I will tell you how to implement Firebase database in Kodular Creator Project.
How to implement Firebase database in Kodular Creator Project?
Step 1: Look for Google option in the sidebar.
Step 2: Now find Firebase Database Component under Google option.
Step 3: And drag and drop the Firebase database component in Viewer.
And now you have implemeted Firebase to your project successfully.
How to connect Firebase with app?
Once you have successfully implemented Firebase in app, then you need to add these things to store and retrieve data.....
1. Create a realtime Database:
First you need to create a realtime database to use Firebase Database in Kodular Creator's App. So, click on Develop option in sidebar and then click on Realtime Database here.
Then click on "Create Database" button to create a new database for your app.
Here, you have created your realtime database Successfully. Now, you have to add some values in Kodular creator Firebase Component.
1. Firebase Token:
In properties of Firebase component on the top you can find an option to add firebase token. This is the token for your Firebase project to store and retrieve data. For getting this firebase token get to your Firebase project dashboard and click on setting icon and then click on Project setting option.
Illustration:
Then you will find Web API Key that is your Firebase Token:
Copy this Web API key and paste it in the Firebase token option in Kodular Creator.
2. Firebase Database URL:
Secondly you have to add a Firebase Database URL in this option to connect Firebase Database with your app. You will get the Firebase URL in your Database in Firebase Console.
This is the Firebase URL which you have to put in your Kodular Creator. So, add this and you have connected your app with Firebase.
3. Project Bucket:
This is the Bucket or the tag under which you want to store the data of your app. You can set different project buckets using Blocks.
How to store Data in Firebase?
For storing data string for any tag you have to set the following blocks when you want to store data.
Here put the tag for which you want to store the value. And put the string for value to store, the value which you want to store for the above tag.
How to Retrieve value for a tag?
For getting data for any tag you need to set these blocks when you want to retrieve value for the given tag.
For this you have to set two types of blocks, First is to call Firebase DB component to get value and second is to use the value found by component. And in this way you can get the value for tag from your database in Firebase.
So, I think you might have now understood "How to use Firebase Database in Kodular?" This was our tutorial for Firebase and we will be back again tomorrow with a complete new Tutorial.
Till then....
Happy Koding.....
Comments
Post a Comment