{"id":4549,"url":"https://github.com/zo0r/react-native-push-notification","last_synced_at":"2025-10-01T17:30:48.149Z","repository":{"id":37285427,"uuid":"47997753","full_name":"zo0r/react-native-push-notification","owner":"zo0r","description":"React Native Local and Remote Notifications","archived":false,"fork":false,"pushed_at":"2024-01-30T05:26:00.000Z","size":1688,"stargazers_count":6773,"open_issues_count":159,"forks_count":2055,"subscribers_count":96,"default_branch":"master","last_synced_at":"2025-01-14T01:05:36.055Z","etag":null,"topics":["android","ios","push-notifications","react-native"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zo0r.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Dallas62"],"custom":["https://www.buymeacoffee.com/Dallas62"]}},"created_at":"2015-12-14T19:53:36.000Z","updated_at":"2025-01-08T07:48:35.000Z","dependencies_parsed_at":"2024-01-08T01:03:38.197Z","dependency_job_id":"ecf4bb6c-90a7-4cd4-a68a-41b4ebaac900","html_url":"https://github.com/zo0r/react-native-push-notification","commit_stats":{"total_commits":603,"total_committers":159,"mean_commits":3.792452830188679,"dds":0.7330016583747927,"last_synced_commit":"fcf40a05175bb79fb5fdfe2ac31bb797bc5008bc"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zo0r%2Freact-native-push-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zo0r%2Freact-native-push-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zo0r%2Freact-native-push-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zo0r%2Freact-native-push-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zo0r","download_url":"https://codeload.github.com/zo0r/react-native-push-notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234883314,"owners_count":18901365,"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":["android","ios","push-notifications","react-native"],"created_at":"2024-01-05T20:17:15.966Z","updated_at":"2025-10-01T17:30:42.819Z","avatar_url":"https://github.com/zo0r.png","language":"Java","readme":"# React Native Push Notifications\n\n[![npm version](https://badge.fury.io/js/react-native-push-notification.svg?update=9)](http://badge.fury.io/js/react-native-push-notification)\n[![npm downloads](https://img.shields.io/npm/dm/react-native-push-notification.svg?update=9)](http://badge.fury.io/js/react-native-push-notification)\n\nReact Native Local and Remote Notifications for iOS and Android\n\n## State of the repository\n\nThis repository is not actively maintained. The main reason is time. The second one is probably the complexity of notifications on both iOS and Android.\nSince this project probably need a huge refactor to fix some issue or to implement new features. I think you should probably consider these alternatives: [Notifee](https://notifee.app) free since september or [react-native-notifications](https://github.com/wix/react-native-notifications).\n\nIf you are interested in being a maintainer of this project, feel free to ask in issues.\n\n## 🎉 Version 7.x is live ! 🎉\n\nCheck out for changes and migration in the CHANGELOG:\n\n[Changelog](https://github.com/zo0r/react-native-push-notification/blob/master/CHANGELOG.md)\n\n# Supporting the project\n\nMaintainers are welcome ! Feel free to contact me :wink:\n\n## Changelog\n\nChangelog is available from version 3.1.3 here: [Changelog](https://github.com/zo0r/react-native-push-notification/blob/master/CHANGELOG.md)\n\n## Installation\n\n### NPM\n\n```\nnpm install --save react-native-push-notification\n```\n\n### Yarn\n\n```\nyarn add react-native-push-notification\n```\n\n**NOTE: If you target iOS you also need to follow the [installation instructions for PushNotificationIOS](https://github.com/react-native-community/react-native-push-notification-ios) since this package depends on it.**\n\n**NOTE: For Android, you will still have to manually update the AndroidManifest.xml (as below) in order to use Scheduled Notifications.**\n\n## Issues\n\nHaving a problem? Read the [troubleshooting](./trouble-shooting.md) guide before raising an issue.\n\n## Pull Requests\n\n[Please read...](./submitting-a-pull-request.md)\n\n## iOS manual Installation\n\nThe component uses PushNotificationIOS for the iOS part. You should follow their [installation instructions](https://github.com/react-native-community/react-native-push-notification-ios).\n\n## Android manual Installation\n\n**NOTE: `firebase-messaging`, prior to version 15 requires to have the same version number in order to work correctly at build time and at run time. To use a specific version:**\n\nIn your `android/build.gradle`\n\n```gradle\next {\n    googlePlayServicesVersion = \"\u003cYour play services version\u003e\" // default: \"+\"\n    firebaseMessagingVersion = \"\u003cYour Firebase version\u003e\" // default: \"21.1.0\"\n\n    // Other settings\n    compileSdkVersion = \u003cYour compile SDK version\u003e // default: 23\n    buildToolsVersion = \"\u003cYour build tools version\u003e\" // default: \"23.0.1\"\n    targetSdkVersion = \u003cYour target SDK version\u003e // default: 23\n    supportLibVersion = \"\u003cYour support lib version\u003e\" // default: 23.1.1\n}\n```\n\n**NOTE: localNotification() works without changes in the application part, while localNotificationSchedule() only works with these changes:**\n\nIn your `android/app/src/main/AndroidManifest.xml`\n\n```xml\n    .....\n    \u003cuses-permission android:name=\"android.permission.VIBRATE\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/\u003e\n\n    \u003capplication ....\u003e\n        \u003c!-- Change the value to true to enable pop-up for in foreground on receiving remote notifications (for prevent duplicating while showing local notifications set this to false) --\u003e\n        \u003cmeta-data  android:name=\"com.dieam.reactnativepushnotification.notification_foreground\"\n                    android:value=\"false\"/\u003e\n        \u003c!-- Change the resource name to your App's accent color - or any other color you want --\u003e\n        \u003cmeta-data  android:name=\"com.dieam.reactnativepushnotification.notification_color\"\n                    android:resource=\"@color/white\"/\u003e \u003c!-- or @android:color/{name} to use a standard color --\u003e\n\n        \u003creceiver android:name=\"com.dieam.reactnativepushnotification.modules.RNPushNotificationActions\" /\u003e\n        \u003creceiver android:name=\"com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher\" /\u003e\n        \u003creceiver android:name=\"com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver\"\u003e\n            \u003cintent-filter\u003e\n                \u003caction android:name=\"android.intent.action.BOOT_COMPLETED\" /\u003e\n                \u003caction android:name=\"android.intent.action.QUICKBOOT_POWERON\" /\u003e\n                \u003caction android:name=\"com.htc.intent.action.QUICKBOOT_POWERON\"/\u003e\n            \u003c/intent-filter\u003e\n        \u003c/receiver\u003e\n\n        \u003cservice\n            android:name=\"com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService\"\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```\n\nIf not using a built in Android color (`@android:color/{name}`) for the `notification_color` `meta-data` item.\nIn `android/app/src/main/res/values/colors.xml` (Create the file if it doesn't exist).\n\n```xml\n\u003cresources\u003e\n    \u003ccolor name=\"white\"\u003e#FFF\u003c/color\u003e\n\u003c/resources\u003e\n```\n\nIf your app has an @Override on onNewIntent in `MainActivity.java` ensure that function includes a super call on onNewIntent (if your `MainActivity.java` does not have an @Override for onNewIntent skip this):\n\n```java\n    @Override\n    public void onNewIntent(Intent intent) {\n        ...\n        super.onNewIntent(intent);\n        ...\n    }\n```\n\n### If you use remote notifications\n\nMake sure you have installed setup Firebase correctly.\n\nIn `android/build.gradle`\n\n```gradle\n\nbuildscript {\n    ...\n    dependencies {\n        ...\n        classpath('com.google.gms:google-services:4.3.3')\n        ...\n    }\n}\n```\n\nIn `android/app/build.gradle`\n\n```gradle\ndependencies {\n  ...\n  implementation 'com.google.firebase:firebase-analytics:17.3.0'\n  ...\n}\n\napply plugin: 'com.google.gms.google-services'\n\n```\n\nThen put your `google-services.json` in `android/app/`.\n\n**Note: [firebase/release-notes](https://firebase.google.com/support/release-notes/android)**\n\n\u003e The Firebase Android library `firebase-core` is no longer needed. This SDK included the Firebase SDK for Google Analytics.\n\u003e\n\u003e Now, to use Analytics or any Firebase product that recommends the use of Analytics (see table below), you need to explicitly add the Analytics dependency: `com.google.firebase:firebase-analytics:17.3.0`.\n\n### If you don't use autolink\n\nIn `android/settings.gradle`\n\n```gradle\n...\ninclude ':react-native-push-notification'\nproject(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android')\n```\n\nIn your `android/app/build.gradle`\n\n```gradle\n dependencies {\n    ...\n    implementation project(':react-native-push-notification')\n    ...\n }\n```\n\nManually register module in `MainApplication.java` (if you did not use `react-native link`):\n\n```java\nimport com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;  // \u003c--- Import Package\n\npublic class MainApplication extends Application implements ReactApplication {\n\n  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {\n      @Override\n      protected boolean getUseDeveloperSupport() {\n        return BuildConfig.DEBUG;\n      }\n\n      @Override\n      protected List\u003cReactPackage\u003e getPackages() {\n\n          return Arrays.\u003cReactPackage\u003easList(\n              new MainReactPackage(),\n              new ReactNativePushNotificationPackage() // \u003c---- Add the Package\n          );\n    }\n  };\n\n  ....\n}\n```\n\n## Usage\n\n**DO NOT USE `.configure()` INSIDE A COMPONENT, EVEN `App`**\n\u003e If you do, notification handlers will not fire, because they are not loaded. Instead, use `.configure()` in the app's first file, usually `index.js`.\n\n\n```javascript\nimport PushNotificationIOS from \"@react-native-community/push-notification-ios\";\nimport PushNotification from \"react-native-push-notification\";\n\n// Must be outside of any component LifeCycle (such as `componentDidMount`).\nPushNotification.configure({\n  // (optional) Called when Token is generated (iOS and Android)\n  onRegister: function (token) {\n    console.log(\"TOKEN:\", token);\n  },\n\n  // (required) Called when a remote is received or opened, or local notification is opened\n  onNotification: function (notification) {\n    console.log(\"NOTIFICATION:\", notification);\n\n    // process the notification\n\n    // (required) Called when a remote is received or opened, or local notification is opened\n    notification.finish(PushNotificationIOS.FetchResult.NoData);\n  },\n\n  // (optional) Called when Registered Action is pressed and invokeApp is false, if true onNotification will be called (Android)\n  onAction: function (notification) {\n    console.log(\"ACTION:\", notification.action);\n    console.log(\"NOTIFICATION:\", notification);\n\n    // process the action\n  },\n\n  // (optional) Called when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. (iOS)\n  onRegistrationError: function(err) {\n    console.error(err.message, err);\n  },\n\n  // IOS ONLY (optional): default: all - Permissions to register.\n  permissions: {\n    alert: true,\n    badge: true,\n    sound: true,\n  },\n\n  // Should the initial notification be popped automatically\n  // default: true\n  popInitialNotification: true,\n\n  /**\n   * (optional) default: true\n   * - Specified if permissions (ios) and token (android and ios) will requested or not,\n   * - if not, you must call PushNotificationsHandler.requestPermissions() later\n   * - if you are not using remote notification or do not have Firebase installed, use this:\n   *     requestPermissions: Platform.OS === 'ios'\n   */\n  requestPermissions: true,\n});\n```\n\n## Example app\n\nExample folder contains an example app to demonstrate how to use this package. The notification Handling is done in `NotifService.js`.\n\nPlease test your PRs with this example app before submitting them. It'll help maintaining this repo.\n\n## Handling Notifications\n\nWhen any notification is opened or received the callback `onNotification` is called passing an object with the notification data.\n\nNotification object example:\n\n```javascript\n{\n    foreground: false, // BOOLEAN: If the notification was received in foreground or not\n    userInteraction: false, // BOOLEAN: If the notification was opened by the user from the notification area or not\n    message: 'My Notification Message', // STRING: The notification message\n    data: {}, // OBJECT: The push data or the defined userInfo in local notifications\n}\n```\n\n## Local Notifications\n\n```js\nPushNotification.localNotification(details: Object)\n```\n\nEXAMPLE:\n\n```javascript\nPushNotification.localNotification({\n  /* Android Only Properties */\n  channelId: \"your-channel-id\", // (required) channelId, if the channel doesn't exist, notification will not trigger.\n  ticker: \"My Notification Ticker\", // (optional)\n  showWhen: true, // (optional) default: true\n  autoCancel: true, // (optional) default: true\n  largeIcon: \"ic_launcher\", // (optional) default: \"ic_launcher\". Use \"\" for no large icon.\n  largeIconUrl: \"https://www.example.tld/picture.jpg\", // (optional) default: undefined\n  smallIcon: \"ic_notification\", // (optional) default: \"ic_notification\" with fallback for \"ic_launcher\". Use \"\" for default small icon.\n  bigText: \"My big text that will be shown when notification is expanded. Styling can be done using HTML tags(see android docs for details)\", // (optional) default: \"message\" prop\n  subText: \"This is a subText\", // (optional) default: none\n  bigPictureUrl: \"https://www.example.tld/picture.jpg\", // (optional) default: undefined\n  bigLargeIcon: \"ic_launcher\", // (optional) default: undefined\n  bigLargeIconUrl: \"https://www.example.tld/bigicon.jpg\", // (optional) default: undefined\n  color: \"red\", // (optional) default: system default\n  vibrate: true, // (optional) default: true\n  vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000\n  tag: \"some_tag\", // (optional) add tag to message\n  group: \"group\", // (optional) add group to message\n  groupSummary: false, // (optional) set this notification to be the group summary for a group of notifications, default: false\n  ongoing: false, // (optional) set whether this is an \"ongoing\" notification\n  priority: \"high\", // (optional) set notification priority, default: high\n  visibility: \"private\", // (optional) set notification visibility, default: private\n  ignoreInForeground: false, // (optional) if true, the notification will not be visible when the app is in the foreground (useful for parity with how iOS notifications appear). should be used in combine with `com.dieam.reactnativepushnotification.notification_foreground` setting\n  shortcutId: \"shortcut-id\", // (optional) If this notification is duplicative of a Launcher shortcut, sets the id of the shortcut, in case the Launcher wants to hide the shortcut, default undefined\n  onlyAlertOnce: false, // (optional) alert will open only once with sound and notify, default: false\n  \n  when: null, // (optional) Add a timestamp (Unix timestamp value in milliseconds) pertaining to the notification (usually the time the event occurred). For apps targeting Build.VERSION_CODES.N and above, this time is not shown anymore by default and must be opted into by using `showWhen`, default: null.\n  usesChronometer: false, // (optional) Show the `when` field as a stopwatch. Instead of presenting `when` as a timestamp, the notification will show an automatically updating display of the minutes and seconds since when. Useful when showing an elapsed time (like an ongoing phone call), default: false.\n  timeoutAfter: null, // (optional) Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled, default: null\n\n  messageId: \"google:message_id\", // (optional) added as `message_id` to intent extras so opening push notification can find data stored by @react-native-firebase/messaging module. \n\n  actions: [\"Yes\", \"No\"], // (Android only) See the doc for notification actions to know more\n  invokeApp: true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true\n\n  /* iOS only properties */\n  category: \"\", // (optional) default: empty string\n  subtitle: \"My Notification Subtitle\", // (optional) smaller title below notification title\n\n  /* iOS and Android properties */\n  id: 0, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID\n  title: \"My Notification Title\", // (optional)\n  message: \"My Notification Message\", // (required)\n  picture: \"https://www.example.tld/picture.jpg\", // (optional) Display an picture with the notification, alias of `bigPictureUrl` for Android. default: undefined\n  userInfo: {}, // (optional) default: {} (using null throws a JSON value '\u003cnull\u003e' error)\n  playSound: false, // (optional) default: true\n  soundName: \"default\", // (optional) Sound to play when the notification is shown. Value of 'default' plays the default sound. It can be set to a custom sound such as 'android.resource://com.xyz/raw/my_sound'. It will look for the 'my_sound' audio file in 'res/raw' directory and play it. default: 'default' (default sound is played)\n  number: 10, // (optional) Valid 32 bit integer specified as string. default: none (Cannot be zero)\n  repeatType: \"day\", // (optional) Repeating interval. Check 'Repeating Notifications' section for more info.\n});\n```\n\n## Scheduled Notifications\n\n```js\nPushNotification.localNotificationSchedule(details: Object)\n```\n\nEXAMPLE:\n\n```javascript\nPushNotification.localNotificationSchedule({\n  //... You can use all the options from localNotifications\n  message: \"My Notification Message\", // (required)\n  date: new Date(Date.now() + 60 * 1000), // in 60 secs\n  allowWhileIdle: false, // (optional) set notification to work while on doze, default: false\n\n  /* Android Only Properties */\n  repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.\n});\n```\n\n## Get the initial notification\n\n```js\nPushNotification.popInitialNotification(callback)\n```\n\nEXAMPLE:\n\n```javascript\nPushNotification.popInitialNotification((notification) =\u003e {\n  console.log('Initial Notification', notification);\n});\n```\n\n## Custom sounds\n\nIn android, add your custom sound file to `[project_root]/android/app/src/main/res/raw`\n\nIn iOS, add your custom sound file to the project `Resources` in xCode.\n\nIn the location notification json specify the full file name:\n\n    soundName: 'my_sound.mp3'\n\n## Channel Management (Android)\n\nTo use channels, create them at startup and pass the matching `channelId` through to `PushNotification.localNotification` or `PushNotification.localNotificationSchedule`.\n\n```javascript\nimport PushNotification, {Importance} from 'react-native-push-notification';\n...\n  PushNotification.createChannel(\n    {\n      channelId: \"channel-id\", // (required)\n      channelName: \"My channel\", // (required)\n      channelDescription: \"A channel to categorise your notifications\", // (optional) default: undefined.\n      playSound: false, // (optional) default: true\n      soundName: \"default\", // (optional) See `soundName` parameter of `localNotification` function\n      importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance\n      vibrate: true, // (optional) default: true. Creates the default vibration pattern if true.\n    },\n    (created) =\u003e console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.\n  );\n```\n\n**NOTE: Without channel, notifications don't work**\n\nIn the notifications options, you must provide a channel id with `channelId: \"your-channel-id\"`, if the channel doesn't exist the notification might not be triggered. Once the channel is created, the channel cannot be updated. Make sure your `channelId` is different if you change these options. If you have created a channel in another way, it will apply options of the channel.\n\nIf you want to use a different default channel for remote notification, refer to the documentation of Firebase:\n\n[Set up a Firebase Cloud Messaging client app on Android](https://firebase.google.com/docs/cloud-messaging/android/client?hl=fr)\n\n```xml\n  \u003cmeta-data\n      android:name=\"com.google.firebase.messaging.default_notification_channel_id\"\n      android:value=\"@string/default_notification_channel_id\" /\u003e\n```\n\nFor local notifications, the same kind of option is available:\n\n- you can use:\n  ```xml\n    \u003cmeta-data\n        android:name=\"com.dieam.reactnativepushnotification.default_notification_channel_id\"\n        android:value=\"@string/default_notification_channel_id\" /\u003e\n  ```\n- If not defined, fallback to the Firebase value defined in the `AndroidManifest`:\n  ```xml\n    \u003cmeta-data\n        android:name=\"com.google.firebase.messaging.default_notification_channel_id\"\n        android:value=\"...\" /\u003e\n  ```\n- If not defined, fallback to the default Firebase channel id `fcm_fallback_notification_channel`\n\n### List channels\n\nYou can list available channels with:\n\n```js\nPushNotification.getChannels(function (channel_ids) {\n  console.log(channel_ids); // ['channel_id_1']\n});\n```\n\n### Channel exists\n\nYou can check if a channel exists with:\n\n```js\nPushNotification.channelExists(channel_id, function (exists) {\n  console.log(exists); // true/false\n});\n```\n\n### Channel blocked\n\nYou can check if a channel blocked with:\n\n```js\nPushNotification.channelBlocked(channel_id, function (blocked) {\n  console.log(blocked); // true/false\n});\n```\n\n### Delete channel\n\nYou can delete a channel with:\n\n```js\nPushNotification.deleteChannel(channel_id);\n```\n\n## Cancelling notifications\n\n### 1) cancelLocalNotification\n\nThe `id` parameter for `PushNotification.localNotification` is required for this operation. The id supplied will then be used for the cancel operation.\n\n```javascript\nPushNotification.localNotification({\n    ...\n    id: '123'\n    ...\n});\nPushNotification.cancelLocalNotification('123');\n```\n\n### 2) cancelAllLocalNotifications\n\n```javascript\nPushNotification.cancelAllLocalNotifications()\n```\n\nCancels all scheduled notifications AND clears the notifications alerts that are in the notification centre.\n\n### 3) removeAllDeliveredNotifications\n\n```javascript\nPushNotification.removeAllDeliveredNotifications();\n```\n\nRemove all delivered notifications from Notification Center\n\n### 4) getDeliveredNotifications\n\n```javascript\nPushNotification.getDeliveredNotifications(callback);\n```\n\nProvides you with a list of the app’s notifications that are still displayed in Notification Center\n\n**Parameters:**\n\n| Name     | Type     | Required | Description                                                 |\n| -------- | -------- | -------- | ----------------------------------------------------------- |\n| callback | function | Yes      | Function which receive an array of delivered notifications. |\n\nA delivered notification is an object containing:\n\n- `identifier` : The identifier of this notification.\n- `title` : The title of this notification.\n- `body` : The body of this notification.\n- `category` : The category of this notification (optional).\n- `userInfo` : An object containing additional notification data (optional).\n- `thread-id` : The thread identifier of this notification, if has one.\n\n### 5) removeDeliveredNotifications\n\n```javascript\nPushNotification.removeDeliveredNotifications(identifiers);\n```\n\nRemoves the specified notifications from Notification Center\n\n**Parameters:**\n\n| Name        | Type  | Required | Description                        |\n| ----------- | ----- | -------- | ---------------------------------- |\n| identifiers | array | Yes      | Array of notification identifiers. |\n\n### 6) getScheduledLocalNotifications\n\n```javascript\nPushNotification.getScheduledLocalNotifications(callback);\n```\n\nProvides you with a list of the app’s scheduled local notifications that are yet to be displayed\n\n**Parameters:**\n\n| Name     | Type     | Required | Description                                                 |\n| -------- | -------- | -------- | ----------------------------------------------------------- |\n| callback | function | Yes      | Function which receive an array of delivered notifications. |\n\nReturns an array of local scheduled notification objects containing:\n\n| Name           | Type   | Description                                              |\n| -------------- | ------ | -------------------------------------------------------- |\n| id             | number | The identifier of this notification.                     |\n| date           | Date   | The fire date of this notification.                      |\n| title          | string | The title of this notification.                          |\n| message        | string | The message body of this notification.                   |\n| soundName      | string | The sound name of this notification.                     |\n| repeatInterval | number | (Android only) The repeat interval of this notification. |\n| number         | number | App notification badge count number.                     |\n| data           | any    | The user info of this notification.                      |\n\n## Abandon Permissions\n\n```js\nPushNotification.abandonPermissions()\n```\nRevokes the current token and unregister for all remote notifications received via APNS or FCM.\n\n## Notification priority\n\n(optional) Specify `priority` to set priority of notification. Default value: \"high\"\n\nAvailable options:\n\n```\n\"max\" = NotficationCompat.PRIORITY_MAX\\\n\"high\" = NotficationCompat.PRIORITY_HIGH\\\n\"low\" = NotficationCompat.PRIORITY_LOW\\\n\"min\" = NotficationCompat.PRIORITY_MIN\\\n\"default\" = NotficationCompat.PRIORITY_DEFAULT\n```\n\nMore information: https://developer.android.com/reference/android/app/Notification.html#PRIORITY_DEFAULT\n\n## Notification visibility\n\n(optional) Specify `visibility` to set visibility of notification. Default value: \"private\"\n\nAvailable options:\n\n```\n\"private\" = NotficationCompat.VISIBILITY_PRIVATE\\\n\"public\" = NotficationCompat.VISIBILITY_PUBLIC\\\n\"secret\" = NotficationCompat.VISIBILITY_SECRET \n```\nMore information: https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PRIVATE\n\n## Notification importance\n\n(optional) Specify `importance` to set importance of notification. Default value: Importance.HIGH  \nConstants available on the `Importance` object. `import PushNotification, {Importance} from 'react-native-push-notification';`\n\nAvailable options:\n```\nImportance.DEFAULT = NotificationManager.IMPORTANCE_DEFAULT\\\nImportance.HIGH = NotificationManager.IMPORTANCE_HIGH\\\nImportance.LOW = NotificationManager.IMPORTANCE_LOW\\\nImportance.MIN = NotificationManager.IMPORTANCE_MIN\\\nImportance.NONE= NotificationManager.IMPORTANCE_NONE\\\nImportance.UNSPECIFIED = NotificationManager.IMPORTANCE_UNSPECIFIED\n```\n\nMore information: https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT\n\n## Show notifications while the app is in foreground\n\nIf you want a consistent results in Android \u0026 iOS with the most flexibility, it is best to handle it manually by prompting a local notification when `onNotification` is triggered by a remote push notification on foreground (check `notification.foreground` prop).\n\nWatch out for an infinite loop triggering `onNotification` - remote \u0026 local notification will trigger it. You can overcome this by marking local notifications' data.\n\n## Notification while idle\n\n(optional) Specify `allowWhileIdle` to set if the notification should be allowed to execute even when the system is on low-power idle modes.\n\nOn Android 6.0 (API level 23) and forward, the Doze was introduced to reduce battery consumption when the device is unused for long periods of time. But while on Doze the AlarmManager alarms (used to show scheduled notifications) are deferred to the next maintenance window. This may cause the notification to be delayed while on Doze.\n\nThis can significantly impact the power use of the device when idle. So it must only be used when the notification is required to go off on a exact time, for example on a calendar notification.\n\nMore information:\nhttps://developer.android.com/training/monitoring-device-state/doze-standby\n\n## Repeating Notifications\n\n(optional) Specify `repeatType` and optionally `repeatTime` (Android-only) while scheduling the local notification. Check the local notification example above.\n\n### iOS\nProperty `repeatType` can only be `month`, `week`, `day`, `hour`, `minute`.\n\nNOTE: `repeatTime` do not work with iOS.\n\n### Android\nProperty `repeatType` could be one of `month`, `week`, `day`, `hour`, `minute`, `time`. \n\nThe interval used can be configured to a different interval using `repeatTime`. If `repeatType` is `time`, `repeatTime` must be specified as the number of milliseconds between each interval.\nFor example, to configure a notification every other day\n\n```javascript\nPushNotification.localNotificationSchedule({\n    ...\n    repeatType: 'day',\n    repeatTime: 2,\n    ...\n});\n```\n\n## Notification Actions\n\n(Android Only)\n\nThis is done by specifying an `actions` parameters while configuring the local notification. This is an array of strings where each string is a notification action that will be presented with the notification.\n\nFor e.g. `actions: ['Accept', 'Reject']`\n\nWhen you handle actions in background (`invokeApp: false`), you can open the application and pass the initial notification by using use `PushNotification.invokeApp(notification)`.\n\nMake sure you have the receiver in `AndroidManifest.xml`:\n\n```xml\n  \u003creceiver android:name=\"com.dieam.reactnativepushnotification.modules.RNPushNotificationActions\" /\u003e\n```\n\nNotifications with inline reply: \n\nYou must register an action as \"ReplyInput\", this will show in the notifications an input to write in. \n\nEXAMPLE:\n```javascript\nPushNotification.localNotificationSchedule({\n  message: \"My Notification Message\", // (required)\n  date: new Date(Date.now() + (60 * 1000)), // in 60 secs\n  actions: [\"ReplyInput\"],\n  reply_placeholder_text: \"Write your response...\", // (required)\n  reply_button_text: \"Reply\" // (required)\n});\n```\n\nTo get the text from the notification: \n\n```javascript\n...\nif(notification.action === \"ReplyInput\"){\n  console.log(\"texto\", notification.reply_text)// this will contain the inline reply text. \n}\n...\n```\n\nFor iOS, you can use:\n\n```javascript\nPushNotification.setNotificationCategories(categories);\n```\n\nAnd use the `category` field in the notification.\n\nDocumentation [here](https://github.com/react-native-push-notification-ios/push-notification-ios#how-to-perform-different-action-based-on-user-selected-action) to add notification actions.\n\n## Set application badge icon\n\n```js\nPushNotification.setApplicationIconBadgeNumber(number: number)\n```\n\nWorks natively in iOS.\n\nUses the [ShortcutBadger](https://github.com/leolin310148/ShortcutBadger) on Android, and as such will not work on all Android devices.\n\n## Android Only Methods\n\n```js\nPushNotification.subscribeToTopic(topic: string)\n```\nSubscribe to a topic (works only with Firebase)\n\n```js\nPushNotification.unsubscribeFromTopic(topic: string)\n```\nUnsubscribe from a topic (works only with Firebase)\n\n## Android Custom Notification Handling\n\nUnlike iOS, Android apps handle the creation of their own notifications. React Native Push Notifications does a \"best guess\" to create and handle incoming notifications. However, when using 3rd party notification platforms and tools, the initial notification creation process may need to be customized.\n\n### Customizing Notification Creation\n\nIf your notification service uses a custom data payload format, React Native Push Notifications will not be able to parse the data correctly to create an initial notification.\n\nFor these cases, you should:\n\n1. Remove the intent handler configuration for React Native Push Notifications from your `android/app/src/main/AndroidManifest.xml`.\n2. Implement initial notification creation as per the instructions from your Provider.\n\n### Handling Custom Payloads\n\nData payloads of notifications from 3rd party services may not match the format expected by React Native Push Notification. When tapped, these notifications will not pass the details and data to the `onNotification()` event handler. Custom `IntentHandlers` allow you to fix this so that correct `notification` objects are sent to your `onNotification()` method.\n\nCustom handlers are added in Application init or `MainActivity.onCreate()` methods:\n\n```java\nRNPushNotification.IntentHandlers.add(new RNPushNotification.RNIntentHandler() {\n  @Override\n  public void onNewIntent(Intent intent) {\n    // If your provider requires some parsing on the intent before the data can be\n    // used, add that code here. Otherwise leave empty.\n  }\n\n  @Nullable\n  @Override\n  public Bundle getBundleFromIntent(Intent intent) {\n    // This should return the bundle data that will be serialized to the `notification.data`\n    // property sent to the `onNotification()` handler. Return `null` if there is no data\n    // or this is not an intent from your provider.\n    \n    // Example:\n    if (intent.hasExtra(\"MY_NOTIFICATION_PROVIDER_DATA_KEY\")) {\n      return intent.getBundleExtra(\"MY_NOTIFICATION_PROVIDER_DATA_KEY\");\n    }\n    return null;\n  }\n});\n```\n\n## Checking Notification Permissions\n\n```js\nPushNotification.checkPermissions(callback: Function) //Check permissions\n```\n\n`callback` will be invoked with a `permissions` object:\n\n- `alert`: boolean\n- `badge`: boolean\n- `sound`: boolean\n\n## iOS Only Methods\n\n```js\nPushNotification.getApplicationIconBadgeNumber(callback: Function) //Get badge number\n```\n\n","funding_links":["https://github.com/sponsors/Dallas62","https://www.buymeacoffee.com/Dallas62"],"categories":["Components","\u003ca name=\"Network:-Native-Modules\"\u003eNetwork: Native Modules\u003c/a\u003e","Java","组件","Libraries","React Native Project Showcase","Notifications"],"sub_categories":["System","系统相关","Push Notifications","UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzo0r%2Freact-native-push-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzo0r%2Freact-native-push-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzo0r%2Freact-native-push-notification/lists"}