![](/img/trans.png)
[英]How to unsubscribe(remove a listener) from React Native Expo push notifications
[英]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.