{"id":29085060,"url":"https://github.com/blitz-mobile-apps/react-native-easy-push-notifications","last_synced_at":"2025-06-27T22:12:09.347Z","repository":{"id":49804028,"uuid":"242703160","full_name":"Blitz-Mobile-Apps/react-native-easy-push-notifications","owner":"Blitz-Mobile-Apps","description":"Native implementation of firebase cloud messaging in react native requiring the bare minimum number of steps to get you up and running.","archived":false,"fork":false,"pushed_at":"2023-11-01T14:22:42.000Z","size":55,"stargazers_count":8,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T20:46:54.465Z","etag":null,"topics":["apns","cloud-messaging","easy-push-notifications","easy-to-use","fcm","fcm-notifications","firebase","notifications","push","push-notifications","react-native"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-easy-push-notifications","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Blitz-Mobile-Apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-24T10:08:21.000Z","updated_at":"2023-11-01T14:22:46.000Z","dependencies_parsed_at":"2022-09-03T17:03:26.823Z","dependency_job_id":null,"html_url":"https://github.com/Blitz-Mobile-Apps/react-native-easy-push-notifications","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Blitz-Mobile-Apps/react-native-easy-push-notifications","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blitz-Mobile-Apps%2Freact-native-easy-push-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blitz-Mobile-Apps%2Freact-native-easy-push-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blitz-Mobile-Apps%2Freact-native-easy-push-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blitz-Mobile-Apps%2Freact-native-easy-push-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blitz-Mobile-Apps","download_url":"https://codeload.github.com/Blitz-Mobile-Apps/react-native-easy-push-notifications/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blitz-Mobile-Apps%2Freact-native-easy-push-notifications/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262341625,"owners_count":23296073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apns","cloud-messaging","easy-push-notifications","easy-to-use","fcm","fcm-notifications","firebase","notifications","push","push-notifications","react-native"],"created_at":"2025-06-27T22:12:00.480Z","updated_at":"2025-06-27T22:12:09.333Z","avatar_url":"https://github.com/Blitz-Mobile-Apps.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [react-native-easy-push-notifications](https://www.npmjs.com/package/react-native-easy-push-notifications)\n[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)\n![Supports Android and iOS](https://img.shields.io/badge/platforms-android%20|%20ios-lightgrey.svg?style=flat-square)\n[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)\n[![NPM](https://img.shields.io/npm/dm/react-native-easy-push-notifications)](https://www.npmjs.com/package/react-native-easy-push-notifications)\n[![Version](https://img.shields.io/npm/v/react-native-easy-push-notifications)](https://www.npmjs.com/package/react-native-easy-push-notifications)\n\n\nReact-Native-Easy-Push-Notifications is developed to help the react-native developers in speeding-up their development process. This package leverages the developer from implementing notifications easily. The implementation is kept point-to-point to provide easy usage to the developer. Follow the guide below to get you up and running with the notifications:\n\n### Installation\nIf you prefer **npm**,\n```sh\n$ npm install react-native-easy-push-notifications --save\n```\n\nIf you prefer **yarn**,\n```sh\n$ yarn add react-native-easy-push-notifications\n```\n## Setup FireBase Project\n\n  - Go to firebase console https://firebase.google.com/\n  - Log-in to your google account and add a project with any name you like.\n  - After successfull creation of the project you will be shown homepage of your project.\n\n### Android\nAndroid setup is a two step process. The first step can be done in two ways:\n#### First Step:\n##### Way 1:\n  - Go to settings -\u003e Project Settings -\u003e scroll to bottom and add an android application.\n  - Add android package name. ( You can find package name in your Manifest.xml )\n  - Click on the Register button.\n  - Download the google-services.json and place it in the android -\u003e app .\n  - Click on the Next button and go to your Project level build.gradle.\n  - Inside your \u003cProject\u003e/build.gradle:\n      - Add  ```firebase_messaging = '20.1.0'``` to buildscript -\u003e ext.\n      - Add  ```google()  // Google's Maven repository``` to buildscript -\u003e repositories.\n      - Add ```classpath 'com.google.gms:google-services:4.3.3' ``` to buildscript -\u003e dependencies.\n      - Add ```google()  // Google's Maven repository ``` to allprojects -\u003e repositories.\n  - Go to App level build.gradle and add following lines:\n      - Add ```apply plugin: 'com.google.gms.google-services' ``` after ``` apply plugin: \"com.android.application\"``` .\n      - Add ```implementation 'com.google.firebase:firebase-messaging:20.1.0' ``` to dependencies.\n      - Click on the Next button and then continue to the console.\n\n##### Way 2:\n  - Open project in Android studio.\n  -  login to your google account.\n  -  Go to Tools -\u003e Firebase -\u003e Cloud Messaging -\u003e Setup Firebase Cloud Messaging from Android studio options.\n  -  Click on **Connect To Firebase** button and from existing FireBase project dropdown, select the project we created in setup firebase section. Click on connect\n  -  Click on **Add FCM to your app** button and then click on **Accept changes** button shown in the dialog.\n  -  In your Project level build.gradle, Add  ```firebase_messaging = '20.1.0'``` to buildscript -\u003e ext.\n#### Second Step:\n  - Open Manifest.xml and following line of code to it:\n      - Add ```android:launchMode=\"singleTop\"``` to Activity tag with name: .MainActivity.\n      - Add following service tag to Manifest.xml:\n      ```sh\n      \u003cservice android:name=\"com.blitzapp.module.push.NotificationsService\"\n                android:exported=\"false\"\u003e\n        \u003cintent-filter\u003e\n            \u003caction android:name=\"com.google.firebase.MESSAGING_EVENT\" /\u003e\n        \u003c/intent-filter\u003e\n    \u003c/service\u003e\n      ```\n     - Add following meta-data tag to Manifest.xml:\n     ```sh\n     \u003cmeta-data android:name=\"com.google.firebase.messaging.default_notification_icon\"\n                android:resource=\"@drawable/notifications_icon\" /\u003e\n    ```\n  - **notifications_icon** is required. You can generate this icon from here: [Icon generate link](https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart\u0026source.clipart=attach_money\u0026source.space.trim=1\u0026source.space.pad=0.05\u0026name=ic_stat_attach_money)\n  - Place the icon generated in the drawable folder.\n  - Go to the MainActivity.java and add following lines of code:\n    - Add this to imports: ```import com.blitzapp.module.push.RNEasyPushNotificationsModule;```\n    - Add this function :  \n    ```sh\n    @Override\n    public void onNewIntent(Intent intent) {\n        Bundle extras = intent.getExtras();\n        if (extras != null) {\n            for (String key : extras.keySet()) {\n                Object value = extras.get(key);\n                Log.d(\"MainActivity\", \"Extras received at onNewIntent:  Key: \" + key + \" Value: \" + value);\n            }\n\n            String title = extras.getString(\"title\");\n            String message = extras.getString(\"body\");\n            if (message != null \u0026\u0026 message.length() \u003e 0) {\n                RNEasyPushNotificationsModule.setExtras(extras);\n            }\n            JSONObject json = new JSONObject();\n            Set\u003cString\u003e keys = extras.keySet();\n            for (String key : keys) {\n                try {\n                    json.put(key, JSONObject.wrap(extras.get(key)));\n                } catch(JSONException e) {\n                    //Handle exception here\n                }\n            }\n            String data = \"\";\n            try {\n                data = json.getString(\"data\");\n\n            } catch (JSONException e) {\n                e.printStackTrace();\n                data = json.toString();\n            }\n            Intent i = new Intent(\"onNotificationTap\");\n\n            i.putExtra(\"data\", data);\n            LocalBroadcastManager.getInstance(this).sendBroadcast(i);\n        }\n    }\n    - Add this segment to onCreate method:\n    ```sh\n    if(RNEasyPushNotificationsModule.activityToOpen == null){\n      RNEasyPushNotificationsModule.activityToOpen = this;\n    }\n\n    Intent i = getIntent();\n    Bundle extras = i.getExtras();\n    if (extras != null) {\n      for (String key : extras.keySet()) {\n        Object value = extras.get(key);\n        Log.d(\"MainActivity\", \"Extras received at onCreate:  Key: \" + key + \" Value: \" + value);\n      }\n\n      String title = extras.getString(\"title\");\n      String message = extras.getString(\"body\");\n      if (message != null \u0026\u0026 message.length() \u003e 0) {\n        RNEasyPushNotificationsModule.setExtras(extras);\n      }\n    }\n    ```\n\n### ios\nIOS setup is a two step process.\n#### First Step:\n  - Go to settings -\u003e Project Settings -\u003e scroll to bottom and add an ios applicaton.\n  - Add your ios app bundle identifer and click on the Next button.\n  - Download the GoogleService-Info.plist and drag it into your project in Xcode.\n  - Click on the Next, then Next and then Continue to the console.\n#### Second Step:\n  - Go to developer.apple.com and then go to certificates,Ids and profiles -\u003e identifiers -\u003e your app identifier -\u003e Push Notifications and enable it.\n  - Open your project in Xcode and go to Signing \u0026 capabilities -\u003e Capability -\u003e enable Push Notifications.\n  - Open your podfile and Add ```   pod 'RNEasyPushNotificationsModule', :path =\u003e '../node_modules/react-native-easy-push-notifications' ```.\n  - Open terminal at root of your project and run following commands:\n  ```sh\n  $ cd ios\n  $ pod install\n  ```\n  - Add ``` #import \"RNEasyPushNotificationsModule.h\" ``` to the imports section.\n  - Open your app's Appdelegate.h and add the following code to the interface section:\n  ```sh\n  {\n  RNEasyPushNotificationsModule *nModule;\n  NSDictionary *dic;\n  }\n  -(NSDictionary *)getLaunchOptions;\n+(RCTBridge *) getSharedBridge;\n  ```\n  - Open your app's Appdelegate.m and add the following code to the didFinishLaunchingWithOptions method:\n  ```sh\nif (launchOptions!=nil) {\nNSMutableDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];\nNSLog(@\"userInfo===%@\", userInfo);\nif (userInfo.count\u003e=1) {\nNSDictionary *apsInfo = [userInfo objectForKey:@\"aps\"];\nNSLog(@\"Received apsInfo Badge: %@\", userInfo);\nRNEasyPushNotificationsModule *nModule = [RNEasyPushNotificationsModule allocWithZone: nil];\n[nModule setRemoteNotification:userInfo];\n    }\n}\n  ```\n\n### React Native\nAfter setting up our project on both android and ios, we are all set to consume this module in react native. Following are the usage of functions exposed by this package:\n\n```sh\nimport reactNativeEasyPushNotifications from 'react-native-easy-push-notifications';\n\ncomponentDidMount(){\n    reactNativeEasyPushNotifications.getDeviceId( deviceId =\u003e {\n            console.log(\"My device id \", deviceId);\n        // This method gives the device id which is returned by the firebase\n        })\n       \n    reactNativeEasyPushNotifications.onMessageReceived(notif =\u003e {\n            console.log(\"onMessageReceived:\", notif);\n        // This method is triggered whenever the app is in foreground and we receive the notification\n        })\n       \n    reactNativeEasyPushNotifications.getLastNotificationData(notif =\u003e {\n            console.log(\"getLastNotificationData:\", notif);\n        // This method is triggered whenever the user taps on the notification\n        })\n}\n```\n\n\n\n\n### Todos\nWe aim to make this package even more robust and powerful by adding following features in the upcoming releases:\n - Reply from notification\n - Add support to view image in notification\n - Add an example project\n - Notification testing dashboard\n\nLicense\n----\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblitz-mobile-apps%2Freact-native-easy-push-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblitz-mobile-apps%2Freact-native-easy-push-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblitz-mobile-apps%2Freact-native-easy-push-notifications/lists"}