Integrate Firebase Push Notifications in Android Application


Prushni Jani

1) Introduction of the tools (here Android N and IDE you are going to use)

Android "Nougat" (codenamed Android N during development) is the seventh major version of the Android operating system.
Android studio is used for developing android applications.

2) Setting up the environment.

In Android Studio, create a new project by navigating to File ⇒ New Project and fill all the required details. When it prompts to select a default activity, select Blank Activity and proceed.

3) Tutorial.

In this tutorial you can learn how to integrate Firebase Push Notifications in android application.


The Google IO 2017 announced the use of FIREBASE in ANDROID. Google has moved from GCM that is Google Cloud Messaging to FCM that is FIREBASE CLOUD MESSAGING.

Firebase helps to build android apps better. Firebase allows to create a wide range to apps.

Let’s check out what FIREBASE provides for the development of an application.

Here is the list :

  1. Realtime Database
  2. Crash Reporting
  3. Authentication
  4. Cloud Functions
  5. Cloud Storage
  6. Hosting
  7. Test Lab for Android
  8. Performance Monitoring
  9. Google Analytics
  10. Cloud Messaging
  11. Dynamic Links
  12. Remote Config
  13. Invites
  14. App Indexing
  15. AdMob
  16. AdWords

We will check with a simple demo on REGISTRATION AND LOGIN by using ANDROID FIREBASE.

Register firebase: On your project in the android studio. As simple as that.

Let’s proceed with the practical. Here, step by step we will create the project and run on a real android device.


1. Create a Project in Android Studio

2. Select your Platform and proceed.

3. Now You have one Activity. We are going to setup FIREBASE now.

4. For setting up the FIREBASE, go to TOOLS=>FIREBASE

5. Here, the window of firebase opens up and select the tool that you want to use. So, lets select the notification of firebase.

6. Once you click on the "receive the notification", the window will be opened with the suggestions. Now click on "connect to firebase"

Now it will ask to create a project on firebase


As soon as the firebase is connected, it will show “CONNECTED” as above.

7. Now click on “ADD NOTIFICATIONS TO THE APP”. It will open a dialog asking for accept changes.

So click on “ACCEPT CHANGES”

8. By including this dependency, the app is ready to get the notifications as the set us is done.

9. Now create a new class MyFirebaseInstanceIDService

10. After creating this class, extend the class to FirebaseInstanceIdService.

11. Import

12. Now in manifest file add the snippet : By adding this, we are registering the service in manifest file.

13. Now add the methods as below:

These methods are used for getting the token from device.

14. Now add the service for getting the notifications from the server.

15. Create a new java class MyFirebaseMessagingService and extend it to FirebaseMessagingService.

In this service, we add two methods:
a) onMessageReceived(RemoteMessage remoteMessage) and
b) sendNotification(String messageBody)

16. Now add the following snippet in manifest file:

17. Now we implement the methods:

18. Now we create notification for getting the message from server

19. Now open the firebase console:

Either you can create new project or you can use the project created from the android studio itself.

20. Once you click on the project, a new window opens:

On the left sided panel, there is a tab of notification, Click on the "NOTIFICATIONS"

Click on "Send your first message" and a new window will be opened where you can write the message.

Add the message and click on send message

And then you are done with the coding. This is how we can implement the android firebase push notifications.


I hope this blog post will help you to how to Integrate Firebase Push Notification in Android. Let me know in a comment if you have any questions regarding Android. I will reply you ASAP.

Full Source Code

Download APK

Related Post

Mobile Application Development Platforms in 2022
28 Oct 2021261 Views

Top-5 Best Mobile Application Development Platform in 2022

It is not an exaggeration to say that Android is the most popular mobile OS with 85% market share and north of 5 million apps in the Google...

Android Emulators
02 Aug 2021214 Views

What are Android Emulators and How to Setup an Android Emulator?

There are a variety of reasons why you would want to run an Android emulator on your PC. Mobile app developers always look to test their app...

Android 11 App Migration
14 Jul 2021226 Views

Android 11 App Migration: Android to Android App Migration Guide

Android 11 launched last year and was released to most Android smartphones by the end of the year. Interestingly, it was one of the most awaited...