Onesignal web-push覆盖

我正在使用OneSignal网络推送通知,通过使用PHP构建的网站向我的客户发送通知。 过了一段时间,我意识到如果我发送第一个通知但客户端不在他的设备上打开</ strong>然后再发送另一个通知,智能手机将不会将它们堆叠在彼此之下</ strong >在通知区域中,而是用第二个覆盖第一个。 这意味着客户端错过了第一次通知。 </ p>

当然,我在此之前试图对其进行研究,但没有成功 - 我是否可能会忽略解释如何解决此错误的文档部分?</ p >

谢谢,
Martin </ p>
</ div>

展开原文

原文

I am using OneSignal web push notifications to deliver notifications to my clients from website built with PHP. After a while, I realized that if I send the first notification but client do not open it on his device and then I deliver another one, smartphones will not stack them below each other in the notification area but rather overwrite the first with the second one. This means that the client just missed first notification.

I, of course, tried to research on it before I asked here, but with no success - did I maybe overlook some section of the documentation explaining how to solve this error?

Thanks, Martin

1个回答

I contacted the official support for OneSignal and got a super simple but detailed solution - might you be dealing with similar issue, see copy of the e-mail below (thank you, Jon:)).

When using our REST API to programmatically send notifications, you can use the undocumented parameter web_push_topic.

In a set of notifications sharing the same web_push_topic, newly received notifications will replace older received notifications with the same topic. Only notifications sharing the same topic will be replaced; notifications without a topic or with a different topic will not be replaced. You can set different topics for different sets of notifications to control which notifications stay on screen.

The web_push_topic value can be any string value.

On Chrome, a maximum of 3 notifications is displayed at any time, even if the other notifications are not related to your site or from OneSignal. This means you can only show 3 categories of notifications to your user, not counting for other notifications that might be displayed at that time.

On Firefox on Windows, many more notifications can be shown at a time (6+).

On Firefox on Mac, and Safari on Mac, only one notification can be shown at a time, even if the other notifications are not related to your site or from OneSignal. Notifications also disappear quickly within 5 seconds and this time is not customizable.

On Chrome/Firefox on Android, multiple notifications can be shown at a time.

If you do not specify web_push_topic , each notification will be replaced by a newer notification. If you do specify web_push_topic, you can choose which notifications will be replaced and which notifications will stack.

When sending a notification using our API, setting a string value for web_push_topic will set the topic for the notification. Any notifications sharing the same topic will replace each other, but any notifications with a different topic won't be replaced.

So suppose you send 4 notifications:

Notification "Open house at 1234 Street at 3 PM this Saturday" with topic 'open-houses'. Notification "Open house at 1234 Street changed to 4 PM this Saturday" with topic 'open-houses'. Notification "20 new houses match your criteria in the Seattle, WA" with topic 'general-updates'. Notification "Find an agent in your area" with topic 'promotional'. The sequence of notifications observed will be:

Notification #1 shows. Notification #2 replaces #1 (even if docked in Mac OS X's notification tray). Notification #3 is shown separately (and if docked in Mac OS X's notification tray, it will use a separate entry). Notification #4 is also shown separately. In the end, when the subscriber checks his unread notifications, he will see three total notifications.

Hopefully that makes more sense!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐