File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
android/src/main/java/cn/jpush/reactnativejpush Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,25 @@ public void sendLocalNotification(ReadableMap map) {
515515 }
516516 }
517517
518+ @ ReactMethod
519+ public void removeLocalNotification (int id ) {
520+ try {
521+ Logger .d (TAG , "removeLocalNotification:" +id );
522+ JPushInterface .removeLocalNotification (getReactApplicationContext (), id );
523+ } catch (Exception e ) {
524+ e .printStackTrace ();
525+ }
526+ }
527+ @ ReactMethod
528+ public void clearLocalNotifications () {
529+ try {
530+ Logger .d (TAG , "clearLocalNotifications" );
531+ JPushInterface .clearLocalNotifications (getReactApplicationContext ());
532+ } catch (Exception e ) {
533+ e .printStackTrace ();
534+ }
535+ }
536+
518537 @ Override
519538 public void onHostResume () {
520539 Logger .d (TAG , "onHostResume" );
Original file line number Diff line number Diff line change 1111 * [ setTags] ( #settags )
1212 * [ cleanTags] ( #cleantags )
1313 * [ sendLocalNotification] ( #sendlocalnotification )
14+ * [ clearLocalNotifications] ( #clearLocalNotifications )
15+ * [ removeLocalNotification] ( #removeLocalNotification )
1416 * [ clearAllNotifications] ( #clearallnotifications )
1517 * [ clearNotificationById] ( #clearnotificationbyId )
1618 * [ 点击推送事件] ( #点击推送事件 )
@@ -194,6 +196,23 @@ JPushModule.resumePush();
194196 })
195197 ```
196198
199+ #### clearLocalNotifications
200+
201+ 移除所有的本地通知
202+
203+ ```
204+ JPushModule.clearLocalNotifications();
205+ ```
206+
207+ #### removeLocalNotification
208+
209+ 根据 notificationId 移除指定的本地通知, notificationId 为 int 类型。
210+
211+ ```
212+ var notificationId = 5;
213+ JPushModule.removeLocalNotification(id);
214+ ```
215+
197216#### clearAllNotifications
198217
199218清除所有通知
Original file line number Diff line number Diff line change 1313 * [ Receive Notification event] ( #receive-notification-event )
1414 * [ Receive Custom Message Event] ( #receive-custom-message-event )
1515 * [ sendLocalNotification] ( #sendlocalnotification )
16+ * [ removeLocalNotification] ( #removeLocalNotification )
17+ * [ clearLocalNotifications] ( #clearLocalNotifications )
1618 * [ clearAllNotifications] ( #clearallnotifications )
1719 * [ clearNotificationById] ( #clearnotificationbyId )
1820* [ iOS Only API] ( #ios-only-api )
@@ -149,6 +151,23 @@ reset tags.
149151 })
150152 ```
151153
154+ #### clearLocalNotifications
155+
156+ Removes all local notifications
157+
158+ ```
159+ JPushModule.clearLocalNotifications();
160+ ```
161+
162+ #### removeLocalNotification
163+
164+ Remove the specified local notification by notificationId(int type)。
165+
166+ ```
167+ var notificationId = 5;
168+ JPushModule.removeLocalNotification(id);
169+ ```
170+
152171#### clearAllNotifications
153172
154173Clear all notifications.
You can’t perform that action at this time.
0 commit comments