You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,37 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
8
8
9
9
### Breaking changes
10
10
11
+
- (Android) Channel Management: In order to limit the scope of responsability of this library, developers are now responsible of the creation of the channels. You can find the documentation at https://github.com/zo0r/react-native-push-notification#channel-management-android. These changes are also made to allow improvements in the future of the library. Here the list of impacts:
12
+
- You must create your channels before triggering a notification.
13
+
- These entries in `AndroidManifest` are deprecated:
- Followings options changed on Android in `localNotification` and `localNotificationSchedule`:
20
+
-`channelId` becomes mandatory (warning if not provided)
21
+
-`channelName` is deprecated
22
+
-`channelDescription` is deprecated
23
+
-`importance` is deprecated
24
+
- These changes help to avoid an issue [#1649](https://github.com/zo0r/react-native-push-notification/issues/1649)
25
+
- (Android) Remove check for the intent `BOOT_COMPLETED`, this should allow more intent action such as `QUICKBOOT_POWERON`. It's recommended to update `AndroidManifest`, the `RNPushNotificationBootEventReceiver` to:
-`@react-native-community/push-notification-ios` is now a `peerDependency`, please make sure that you installed this library with NPM or YARN.
12
36
- (Android) Fix a bug where notification data are not inside `data` property after been pressed by user. When sending notification + data and app in background.
13
-
14
-
### Features
37
+
- (Android) Add more fields from the firebase notification part. (Thanks to @fattomhk with this PR [#1626](https://github.com/zo0r/react-native-push-notification/pull/1626))
channelId:"your-channel-id", // (required) channelId, if the channel doesn't exist, it will be created with options passed above (importance, vibration, sound). Once the channel is created, the channel will not be update. Make sure your channelId is different if you change these options. If you have created a custom channel, it will apply options of the channel.
ongoing:false, // (optional) set whether this is an "ongoing" notification
326
321
priority:"high", // (optional) set notification priority, default: high
327
322
visibility:"private", // (optional) set notification visibility, default: private
328
-
importance:"high", // (optional) set notification importance, default: high
329
323
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)
330
324
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
331
-
channelId:"your-custom-channel-id", // (optional) custom channelId, if the channel doesn't exist, it will be created with options passed above (importance, vibration, sound). Once the channel is created, the channel will not be update. Make sure your channelId is different if you change these options. If you have created a custom channel, it will apply options of the channel.
332
325
onlyAlertOnce:false, // (optional) alert will open only once with sound and notify, default: false
333
326
334
327
when:null, // (optionnal) Add a timestamp 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.
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.
339
332
340
-
actions:'["Yes", "No"]', // (Android only) See the doc for notification actions to know more
333
+
actions: ["Yes", "No"], // (Android only) See the doc for notification actions to know more
341
334
invokeApp:true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true
342
335
343
336
/* iOS only properties */
@@ -395,14 +388,14 @@ In the location notification json specify the full file name:
395
388
396
389
## Channel Management (Android)
397
390
398
-
To use custom channels, create them at startup and pass the matching `channelId` through to `PushNotification.localNotification`
391
+
To use channels, create them at startup and pass the matching `channelId` through to `PushNotification.localNotification` or `PushNotification.localNotificationSchedule`.
399
392
400
393
```javascript
401
394
PushNotification.createChannel(
402
395
{
403
-
channelId:"custom-channel-id", // (required)
404
-
channelName:"Custom channel", // (required)
405
-
channelDescription:"A custom channel to categorise your custom notifications", // (optional) default: undefined.
396
+
channelId:"channel-id", // (required)
397
+
channelName:"My channel", // (required)
398
+
channelDescription:"A channel to categorise your notifications", // (optional) default: undefined.
406
399
soundName:"default", // (optional) See `soundName` parameter of `localNotification` function
407
400
importance:4, // (optional) default: 4. Int value of the Android notification importance
408
401
vibrate:true, // (optional) default: true. Creates the default vibration patten if true.
@@ -411,47 +404,9 @@ To use custom channels, create them at startup and pass the matching `channelId`
411
404
);
412
405
```
413
406
414
-
Channels with ids that do not exist are generated on the fly when you pass options to `PushNotification.localNotification` or `PushNotification.localNotificationSchedule`.
415
-
416
-
The pattern of `channel_id` is:
417
-
418
-
```
419
-
rn-push-notification-channel-id-(importance: default "4")(-soundname, default if playSound "-default")-(vibration, default "300")
420
-
```
421
-
422
-
By default, 1 channel is created:
423
-
424
-
- rn-push-notification-channel-id-4-default-300 (used for remote notification if none already exist).
**NOTE: Without channel, remote notifications don't work**
434
408
435
-
In the notifications options, you can provide a custom channel id with `channelId: "your-custom-channel-id"`, if the channel doesn't exist, it will be created with options passed above (importance, vibration, sound). Once the channel is created, the channel will not be update. Make sure your `channelId` is different if you change these options. If you have created a custom channel in another way, it will apply options of the channel.
436
-
437
-
Custom and generated channels can have custom name and description in the `AndroidManifest.xml`, only if the library is responsible of the creation of the channel.
438
-
You can also use `channelName` and `channelDescription` when you use to override the name or description. Once the channel is created, you won't be able to update them.
android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION FOR SILENT CHANNEL"/>
454
-
```
409
+
In the notifications options, you must provide a channel id with `channelId: "your-channel-id"`, if the channel doesn't exist the notification might not e triggered. Once the channel is created, the channel cannot be update. 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.
455
410
456
411
If you want to use a different default channel for remote notification, refer to the documentation of Firebase:
Copy file name to clipboardExpand all lines: android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationBootEventReceiver.java
+22-24Lines changed: 22 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -20,32 +20,30 @@ public class RNPushNotificationBootEventReceiver extends BroadcastReceiver {
0 commit comments