How to Add Firebase Realtime Database to Android Apps

in utopian-io •  7 years ago  (edited)

What is Firebase Realtime Database?

Firebase Database is a cloud-hosted database that made by google to help developer not give much effort and time to handle the backend thing like real-time synchronize and offline support.
Firebase Realtime Database store and sync data into the cloud server, and when ever you update the database, it will notifies all interested devices in milliseconds. This database also optimized for offline condition. because when user go offline or lost their connections, Firebase Database STK uses a local cache on device to store the last changes. When user comes back online, the saved local data automatically synchronized. and firebase realtime database is so secure, even though it cloud-based because user can set who have the access to the database. firebase database is NoSQL database because the data is saved on JSON tree rather than on table, so it eliminated the need for complex SQL queries.

Requirement

  1. Make sure you already have google account
  2. the project that want to connect to firebase database
    3.Android Studio(Minimun Version 2.2)
  3. Android 4.0 devices or Higher.

Let's Start

We have to create firebase project using android studio by following this step :
1. select menu tools->firebase
Select Firebase Menu.png

2. There are many services that Firebase offered, but in this tutorial we only using firebase real time database, so we gonna click Realtime Database and select save and retrieve data.
Select Firebase Realtime Database.png

3. Select connect to Firebase
Connect to database first.png

4. Because we don't have existing firebase project, we will create a new one. if you want the firebase project has the same name with your apps project, you can directly choose country, or if you want the different name, just fill it with your favorite name. In this tutorial, i will use the same name with the apps.
Connect to database first.png

5.Choose country from the project. This link is the reason why we have to choose country to create firebase project.
Select Country.png

6. If everything is done, just click connect to firebase and wait for some seconds
connect to firebase.png

7. If we success to create our firebase project, this sign will appear
image.png
that means our firebase realtime database is ready to use. but, we cannot add firebase realtime database to our apps, because the firebase dependencies in gradle file is not added yet. so, we must add the gradle file by following this step.

8. Click button Add the Realtime Database to your app.
add the realtime database to your app.png

9. A pop up message will come to inform us that a new dependencies will be added in the build.gradle file,so we can use firebase database feature in our apps. just click Accept change on that pop up.
Accept change in gradle file.png

10. Congrats!! :) our firebase realtime database has been added to our apps and ready to use.
image.png

I think this is what i can share right now. You can make it better by modify as you want too. Thanks for reading this tutorial.

Cheers



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Good post :)

thanks @kakilasak :)

mantap bang

Makasii kak :)

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks :)

Hey @jaysilen07 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x