# Push Notification for Android

Hi Everyone, Welcome back! Hope you all’re doing great.

Today, I’m going to tell you how you can add push notification feature in your react native application with firebase.

Steps:

1. Firstly, it requires firebase integration within your react native app. For same you can go through my previous article- [https://push-notification-for-react-native-app.hashnode.dev/integration-firebase-with-react-native-project](https://push-notification-for-react-native-app.hashnode.dev/integration-firebase-with-react-native-project)
    
2. Install messaging library within your project-
    
    **npm i @react-native-firebase/messaging**
    
3. For android permission to get notification-
    
    ```text
    import {PermissionsAndroid} from 'react-native';
      PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
    ```
    
    Create a folder name with Notification under your project and create Notification.ts file and add permissions inside the same file-
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1753006214137/4242f32f-9915-4262-b2b3-9eec74573ec4.png align="center")
    
    5. Now to setup a background handler, call the `setBackgroundMessageHandler` outside of your application logic as early as possible:
        
    
    ```jsx
    // index.js
    import { AppRegistry } from 'react-native';
    import messaging from '@react-native-firebase/messaging';
    import App from './App';
    
    // Register background handler
    messaging().setBackgroundMessageHandler(async remoteMessage => {
      console.log('Message handled in the background!', remoteMessage);
    });
    
    AppRegistry.registerComponent('app', () => App);
    ```
    

At last call useNotification method from your App.tsx file-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1753006316768/5f96cae2-d55c-4b34-881d-dec540a01920.png align="center")

The above steps are for notifications when app is not in use-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1753006386282/b5ca3744-aec5-43d5-a6cb-021dffbbbfff.png align="center")

Lastly, you can send notification from firebase→ cloud messaging and create your first campagin.

!! Congrats🎉🎉🎉 you have successfully added push notification feature in your application.
