Greetings People!

Today I am going write about Firebase, which will be targeting mostly the people who don’t know what Firebase is.

What is Firebase?
Before Google owned Firebase. It was real-time database. Now it has many other features like Cloud Messaging, Storage and etc. Read more

Lets start with making a simple application. Open https://console.firebase.google.com/. Login with your google account. Click Create New Project add name and location to it then click Create Project.

You’ll be redirected to your project’s dashboard. Then click on Add Firebase to your Android app

Add your package name. I have already created a project so I added its name. Then click Add App.

After clicking that you’ll get a google-services.json file.

Open your project in Android Studio and in the Explorer paste your google-services.json file under app folder.

In your Project build.gradle.

And in your Module build.gradle.

Click on your Database then click Rules. Make Read and Write both to true.

After that open your activty_main.xml and add a Edit text and a Button, and reference in a the MainActivity.

Create Firebase database object by using the following code:

Now its time to set values to Firebase. In your button listener.

In order to listen to changes to Firebase.

With this being done. You’re all set up and now ready to set data to Firebase.
Run your project and test by sending data.

Testing on Simulator.

You can find this project on Github.
If you have any questions leave a comment. I’ll get back to you as soon as I can. 🙂

See ya!

Share:

administrator

Aaqib is an enthusiastic programmer with the love of Swift and anything that looks like Swift i.e Kotlin. He loves writing code in Swift, and exploring new technology and platforms. He likes to listen to old music. When he is not writing code, he's probably spend his time watching movies, tv-shows or anime, or either doing some research for writing the next article. He started Kode Snippets in 2015.

23 Comments

  • NA, May 29, 2016 @ 6:04 pm Reply

    Too difficult for beginner please make it simple.

    • Aaqib Hussain, May 29, 2016 @ 6:20 pm Reply

      Can you point me out from where?

  • Homepage, November 25, 2016 @ 12:13 am Reply

    … [Trackback]

    […] Read More here: kodesnippets.com/index.php/2016/05/29/getting-started-with-firebase-in-android/ […]

  • Blackjack Online, March 26, 2018 @ 11:02 pm Reply

    You actually make it seem really easy together with your presentation however I to find this topic to be actually something that I believe I might never understand.
    It sort of feels too complex and very vast for me. I am having a look ahead on your
    next publish, I’ll attempt to get the grasp of it!

  • agen joker123, March 27, 2018 @ 11:07 pm Reply

    First off I want to say terrific blog! I had a quick question which I’d like to ask if you do
    not mind. I was interested to know how you center yourself and clear your thoughts prior to writing.
    I’ve had a difficult time clearing my thoughts in getting my thoughts
    out. I do enjoy writing however it just seems like the first 10 to
    15 minutes are generally lost just trying to figure out how to
    begin. Any suggestions or tips? Thanks!

    • Aaqib Hussain, March 28, 2018 @ 11:18 am Reply

      Hi,
      Really appreciate your kind words.
      When I started writing blogs, I had a purpose which was to not let another developer go through the same pain of implementing something as I did. So this what helps and motivates me to write. Before writing I start to research on the thing I am going to write on, and create a sample project. After I’m done with the sample app, more than half of my work is done then all I have to do is come up with some words to explain what I have done. Hope this helps.
      Cheers!

  • xsugar18, March 29, 2018 @ 3:14 am Reply

    I don’t even know how I ended up here, but I thought this post was great.
    I do not know who you are but certainly you are going to a famous blogger if you
    aren’t already 😉 Cheers!

    • Aaqib Hussain, March 29, 2018 @ 10:08 am Reply

      Thanks for the kind words. *fingers crossed*

  • 2018 calendar printable, April 2, 2018 @ 2:58 pm Reply

    Hello my family member! I want to say that this article is amazing, great written and come
    with almost all significant infos. I’d like to see more posts like
    this .

  • social security office near me, May 14, 2018 @ 4:08 am Reply

    Hurrah! In the end I got a website from where I know how to really get valuable data regarding my study and knowledge.

  • humpback whale migration, May 14, 2018 @ 5:11 am Reply

    bookmarked!!, I like your site!

  • cheap custom essay writing service, July 20, 2018 @ 6:53 am Reply

    Your style is sο unique inn comparison tо otһeг folks I have read stuff from.

    Ι aρpreciate yоu for posting ԝhen you’ve got the opportunity,
    Guess Ӏ’ll ϳust book mark this blog.

  • mortgage payment calculator, July 23, 2018 @ 2:15 pm Reply

    I have to thank you for the efforts you have put in penning
    this site. I am hoping to see the same high-grade content by you in the
    future as well. In truth, your creative writing abilities has encouraged
    me to get my own site now 😉

  • details, July 27, 2018 @ 3:47 pm Reply

    I’ve been surfing online more than three hours today,
    yet I never found any interesting article like yours. It’s pretty worth
    enough for me. Personally, if all website owners and bloggers made good content as you did, the internet will be much more useful than ever before.

  • infomapp.com, July 28, 2018 @ 6:57 am Reply

    My brother suggested I might like this web site.
    He was totally right. This post truly made my day.
    You can not imagine just how much time I had spent for this
    information! Thanks!

  • http://totokini.org, July 31, 2018 @ 5:46 pm Reply

    I’m amazed, I have to admit. Rarely do I come across a blog that’s both equally
    educative and engaging, and without a doubt, you have
    hit the nail on the head. The issue is something that too few men and women are speaking intelligently about.
    I’m very happy I stumbled across this during my hunt for something concerning
    this.

  • ประดับยนต์, August 29, 2018 @ 10:20 pm Reply

    Hi I am so happy I found your website, I really found you by error,
    while I was looking on Digg for something else, Regardless I am here now
    and would just like to say cheers for a remarkable
    post and a all round thrilling blog (I also love the theme/design),
    I don’t have time to look over it all at the minute but I have saved it and also included your
    RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome job.

  • indotogel, September 6, 2018 @ 11:29 am Reply

    Hello, I enjoy reading through your post. I like to write a little comment to support you.

  • Shanon, September 9, 2018 @ 4:49 am Reply

    Great blog you have here.. It’s difficult to find quality
    writing like yours nowadays. I seriously appreciate people like you!

    Take care!!

  • minecraft, September 16, 2018 @ 11:38 am Reply

    Very good post. I’m facing a few of these issues as
    well..

  • Agen Togel, September 21, 2018 @ 11:27 pm Reply

    Just wish to say your article is as astounding. The clarity in your post is simply excellent and i can assume you are an expert on this
    subject. Well with your permission allow me to grab your RSS feed to keep
    updated with forthcoming post. Thanks a million and please carry on the gratifying work.

  • Get Free Followers, October 15, 2018 @ 7:25 am Reply

    fantastic publish, very informative. I wonder why the opposite experts of
    this sector don’t notice this. You should continue your writing.
    I’m confident, you’ve a great readers’ base already!

  • Social Security Office Near Me, November 27, 2018 @ 7:38 pm Reply

    I just want to find a firebase in android..
    Thank you for adding valuable information of firebase in android.

Leave a Reply

Your email address will not be published. Required fields are marked *