doq8211 2018-06-28 09:45
浏览 134
已采纳

Onesignal web-push覆盖

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条回答

  • dqeznd1697 2018-07-05 21:09
    关注

    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!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?