Android Push Notification Tutorial Using Google Firebase


Firebase Push Notification :

Firebase Push Notification is a common feature we observe now a days in every app like social media.

This functionality will let apps show the latest message also every new message on the device is shown in the form of Push Notifications. Android Tutorial on Google Firebase Push Notification will let you know how to implement them much easily.

Firebase Push notifications also makes your app interactive, by sending the latest info and let user’s know it even they are not currently using your app as these services run on the background.

When ever there is any update by change in the app service you app need to not make multiple api calls to check for the update, it can directly know from the data received through Firebase push notifications.


Android Firebase Push Notification


Google Firebase Push Notifications will let you implement push notifications instantly by registering your device and adding necessary settings which makes your app enabled with push notifications.


Firebase Push Notification Video :


Adding Firebase Push Notification to your project :



dependencies {
    implementation ''




buildscript {
    repositories {
    dependencies {
        classpath ''
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath ''

allprojects {
    repositories {


To get SHA1 Key please refer this link —  SHA1 Generating Process


Now add google-services.json file to your project by using this file firebase push notifications services can be implemented in your app not only push notifications even analytics, login, data storage, and many ore services can be implemented based on this json file.


We are not adding any element in the layout file.


MainActivity :

We will be initializing the app using firebase and fetch the token which can be used to receive firebase push notifications.Based on the token devices are identified.


public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

        Log.d(TAG, "Refreshed token: " + FirebaseInstanceId.getInstance().getToken());


FcmService :

Using the FCM service we can fetch the latest token and can use it to continue using Firebase Push Notifications also update it to the database.


public class FcmService extends FirebaseInstanceIdService{

    public void onTokenRefresh() {
        // Get updated InstanceID token.
        String refreshedToken = FirebaseInstanceId.getInstance().getToken();
        Log.d(TAG, "Refreshed token: " + refreshedToken);




AndroidManifest.xml :

Need to specify the service in manifest file to make it start working with firebase push notification.



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""

        <activity android:name=".MainActivity">
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

                <action android:name=""/>




If you are having any query’s in this tutorial on Android Firebase Push Notification do let us know in the comment section below. If you like this tutorial do like and share us for more interesting updates.

Show Buttons
Hide Buttons
Read previous post:
Android Glide Library Tutorial || Glide Image Library

  Android Glide Library : We have seen few image loading library's earlier now its turn for a fastest image...