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.
* dev: (28 commits)
Release version 5.0.0.
Fix behaviour of popInitialNotification and onNotification. Fix foreground value.
fix popInitialNotification and null pointer
Apply changes to popInitialNotification.
make sure data/userInfo is an object before spreading
keep notification data from fcm while populating data userInfo
Fix case of small/large icon null.
Add tests for channel update. #1549
Update CHANGELOG.md
[Android] Allow to change default notification channel name after it's creation #1549
align onNotification on both platforms
Rename `channelDesc` to `channelDescription`.
Update code from recent PR for scheduled notifications
return notification id in onNotification method on iOS
populate userInfo with id on both platforms
revert changes
reflecting userInfo working on both platforms in documentation and example
"@react-native-community/push-notification-ios": "^1.3.0"
add data to android notification when scheduling
Add docs for icon strings
...
# Conflicts:
# README.md
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13-2
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,28 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
+
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
6
8
7
## [Unreleased]
9
8
10
9
### Breaking changes
11
10
11
+
- (Android/iOS) Unify returned values between iOS and Android [#1516](https://github.com/zo0r/react-native-push-notification/pull/1516).
12
+
- (Android/iOS) `.popInitialNotification(callback)` now return the same format as `onNotification()`.
13
+
- (Android) `popInitialNotification` in `configure()` now trigger only once on app startup, same as iOS.
14
+
- (Android) `notification.foreground` now return the good value, before the value was `false` most of the time.
15
+
12
16
### Features
13
17
18
+
- (Android) Add function `createChannel` for custom Android channel support [#1509](https://github.com/zo0r/react-native-push-notification/pull/1509)
19
+
- (Android) Add Android `messageId` to enable integration with `react-native-firebase/messaging`[#1510](https://github.com/zo0r/react-native-push-notification/pull/1510)
20
+
- (Android) Add support for `onlyAlertOnce` property [#1519](https://github.com/zo0r/react-native-push-notification/pull/1519)
21
+
- (Android) Allow to change default notification channel name after it's creation [#1549](https://github.com/zo0r/react-native-push-notification/pull/1549)
22
+
14
23
### Fixed
15
24
25
+
- (Android) `popInitialNotification` in `configure()` now trigger only once and do not trigger twice `onNotification()` when user press the notification, more details: [#1516](https://github.com/zo0r/react-native-push-notification/pull/1516).
26
+
- (Android) `notification.foreground` now return the good value, before the value was `false` most of the time.
Maintaining this project takes time. To help allocate time, you can Buy Me a Coffee :wink:
18
+
19
+
<ahref="https://www.buymeacoffee.com/Dallas62"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/default-blue.png"alt="Buy Me A Coffee"style="height: 51px!important;width: 217px!important;" ></a>
15
20
16
21
## Supported React Native Versions
17
22
@@ -302,13 +307,12 @@ EXAMPLE:
302
307
```javascript
303
308
PushNotification.localNotification({
304
309
/* Android Only Properties */
305
-
id:0, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
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
328
332
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.
329
333
onlyAlertOnce:false, //(optional) alert will open only once with sound and notify, default: false
330
-
334
+
335
+
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.
336
+
331
337
actions:'["Yes", "No"]', // (Android only) See the doc for notification actions to know more
332
338
invokeApp:true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true
333
339
334
340
/* iOS only properties */
335
341
alertAction:"view", // (optional) default: view
336
342
category:"", // (optional) default: empty string
337
-
userInfo: {}, // (optional) default: {} (using null throws a JSON value '<null>' error)
338
343
339
344
/* iOS and Android properties */
345
+
id:0, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
340
346
title:"My Notification Title", // (optional)
341
347
message:"My Notification Message", // (required)
348
+
userInfo: {}, // (optional) default: {} (using null throws a JSON value '<null>' error)
342
349
playSound:false, // (optional) default: true
343
350
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)
344
351
number:10, // (optional) Valid 32 bit integer specified as string. default: none (Cannot be zero)
In android, add your custom sound file to `[project_root]/android/app/src/main/res/raw`
@@ -372,7 +391,23 @@ In the location notification json specify the full file name:
372
391
373
392
## Channel Management (Android)
374
393
375
-
This library doesn't include a full Channel Management at the moment. Channels are generated on the fly when you pass options to `PushNotification.localNotification` or `PushNotification.localNotificationSchedule`.
394
+
To use custom channels, create them at startup and pass the matching `channelId` through to `PushNotification.localNotification`
395
+
396
+
```javascript
397
+
PushNotification.createChannel(
398
+
{
399
+
channelId:"custom-channel-id", // (required)
400
+
channelName:"Custom channel", // (required)
401
+
channelDescription:"A custom channel to categorise your custom notifications", // (optional) default: undefined.
402
+
soundName:"default", // (optional) See `soundName` parameter of `localNotification` function
403
+
importance:4, // (optional) default: 4. Int value of the Android notification importance
404
+
vibrate:true, // (optional) default: true. Creates the default vibration patten if true.
405
+
},
406
+
(created) =>console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
407
+
);
408
+
```
409
+
410
+
Channels with ids that do not exist are generated on the fly when you pass options to `PushNotification.localNotification` or `PushNotification.localNotificationSchedule`.
376
411
377
412
The pattern of `channel_id` is:
378
413
@@ -647,10 +682,6 @@ Works natively in iOS.
647
682
648
683
Uses the [ShortcutBadger](https://github.com/leolin310148/ShortcutBadger) on Android, and as such will not work on all Android devices.
649
684
650
-
## Sending Notification Data From Server
651
-
652
-
Same parameters as `PushNotification.localNotification()`
653
-
654
685
## Android Only Methods
655
686
656
687
`PushNotification.subscribeToTopic(topic: string)` Subscribe to a topic (works only with Firebase)
0 commit comments