Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit a97635e

Browse files
committed
Fixes #1878
1 parent 4b7e095 commit a97635e

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,42 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
1212

1313
### Fixed
1414

15+
## [7.2.2] 2021-03-04
16+
17+
### Fixed
18+
19+
- (Android) Fix: Could not invoke RNPushNotification.getDeliveredNotifications. [#1878](https://github.com/zo0r/react-native-push-notification/issues/1878)
20+
1521
## [7.2.1] 2021-02-11
1622

1723
### Fixed
1824

19-
- (iOS) Fix `playSound` options on local notifications. [1858](https://github.com/zo0r/react-native-push-notification/issues/1858#issuecomment-775714298)
25+
- (iOS) Fix `playSound` options on local notifications. [#1858](https://github.com/zo0r/react-native-push-notification/issues/1858#issuecomment-775714298)
2026

2127
## [7.2.0] 2021-01-24
2228

2329
### Features
2430

25-
- (Android) Handle localization for notification title and body [1837](https://github.com/zo0r/react-native-push-notification/pull/1837)
31+
- (Android) Handle localization for notification title and body [#1837](https://github.com/zo0r/react-native-push-notification/pull/1837)
2632

2733
## [7.1.1] 2021-01-20
2834

2935
### Fixed
3036

31-
- (Android) unsubscribeFromTopic function fix [1831](https://github.com/zo0r/react-native-push-notification/pull/1831)
37+
- (Android) unsubscribeFromTopic function fix [#1831](https://github.com/zo0r/react-native-push-notification/pull/1831)
3238

3339
## [7.1.0] 2021-01-16
3440

3541
# Features
3642

37-
- (Android) Add hooks to intent handling and bundle parsing [1819](https://github.com/zo0r/react-native-push-notification/pull/1819)
43+
- (Android) Add hooks to intent handling and bundle parsing [#1819](https://github.com/zo0r/react-native-push-notification/pull/1819)
3844

3945
## [7.0.0] 2020-12-23
4046

4147
### Breaking changes
4248

43-
- (iOS) Replace deprecated local notification methods on iOS [1751](https://github.com/zo0r/react-native-push-notification/pull/1751)
44-
- (Android) Rename the Android package from `RNPushNotification` to `ReactNativePushNotification` resolve [893](https://github.com/zo0r/react-native-push-notification/issues/893)
49+
- (iOS) Replace deprecated local notification methods on iOS [#1751](https://github.com/zo0r/react-native-push-notification/pull/1751)
50+
- (Android) Rename the Android package from `RNPushNotification` to `ReactNativePushNotification` resolve [#893](https://github.com/zo0r/react-native-push-notification/issues/893)
4551
- (Android) Allow `userInfo` to be stored in scheduled notification as in iOS (mapped as `data` on press or list scheduled notifications).
4652

4753
### Features

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,15 @@ public void clearDeliveredNotifications(ReadableArray identifiers) {
723723

724724
@RequiresApi(api = Build.VERSION_CODES.M)
725725
public WritableArray getDeliveredNotifications() {
726+
WritableArray result = Arguments.createArray();
727+
728+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
729+
return result;
730+
}
731+
726732
NotificationManager notificationManager = notificationManager();
727733
StatusBarNotification delivered[] = notificationManager.getActiveNotifications();
728734
Log.i(LOG_TAG, "Found " + delivered.length + " delivered notifications");
729-
WritableArray result = Arguments.createArray();
730735
/*
731736
* stay consistent to the return structure in
732737
* https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications

example/App.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ export default class App extends Component {
112112
}}>
113113
<Text>Console.Log Scheduled Local Notifications</Text>
114114
</TouchableOpacity>
115+
<TouchableOpacity
116+
style={styles.button}
117+
onPress={() => {
118+
this.notif.getDeliveredNotifications(notifs => console.log(notifs));
119+
}}>
120+
<Text>Console.Log Delivered Notifications</Text>
121+
</TouchableOpacity>
115122
<TouchableOpacity
116123
style={styles.button}
117124
onPress={() => {

example/NotifService.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,8 @@ export default class NotifService {
170170
getScheduledLocalNotifications(callback) {
171171
PushNotification.getScheduledLocalNotifications(callback);
172172
}
173+
174+
getDeliveredNotifications(callback) {
175+
PushNotification.getDeliveredNotifications(callback);
176+
}
173177
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-push-notification",
3-
"version": "7.2.1",
3+
"version": "7.2.2",
44
"description": "React Native Local and Remote Notifications",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)