繁体   English   中英

有没有办法在新通知到达时删除已发送的通知? 反应本机推送通知

[英]Is there any way to remove delivered notifications upon arrival of a new one? react-native-push-notifications

我的情况是我只想在新通知到达时删除已发送的通知。 有没有办法使用 react-native-push-notification 来做到这一点

也许你正在寻找这个:

PushNotification.configure({
  onNotification: function () {
    PushNotification.cancelAllLocalNotifications()
    // or if you want to cancel only by id:
    PushNotification.cancelLocalNotifications({id: '123'});
  },
}

我认为这仅在应用程序处于后台或前台时才有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM