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!

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

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 蓝桥oj3931,请问我错在哪里
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state