在设备上收到时丢弃推送通知
我正在使用 OneSignal 向 iOS 和 Android 设备发送推送通知。在 iOS 和 Android 设备上收到推送通知后是否可以将其丢弃?这不是全部,而是一些基于有效负载数据以及用户是否在后台或前台运行设备。
更新:
“丢弃”意味着它永远不会显示为通知。
如果我不想通过更新打扰用户(如果他们已经在前台使用其应用程序,但我想在后台显示通知),我有什么选择?
I'm using OneSignal to send push notifications to iOS and Android devices. Is it possible to discard a push notification when it's received on a iOS and Android device? It's not all of them, but some based on the payload data and if the user has the device in the background or foreground.
Update:
"discard" meaning that it is never shown as a notification.
What are my options when I don't want to disturb users with updates if they are already in foreground using their app, but in background I like to show the notification?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 onsignal 中,您需要使用
setNotificationwillshowinforegroggnhandler
方法来决定是否需要向用户显示通知。注:有关更多信息,您可以检查文档。
https://documentation.oneignal.com/ doc/sdk-notification-event手柄#前景 - 通知重新认识的事件
In OneSignal you want to use
setNotificationWillShowInForegroundHandler
method to decide whether the need to show a notification to the user or not.Note: For more info, you can check the documentation.
https://documentation.onesignal.com/docs/sdk-notification-event-handlers#foreground-notification-received-event