How does Facebook Messenger clear push notifications from the lock screen if you’ve read them on desktop?

后端 未结 4 1089
面向向阳花
面向向阳花 2020-12-07 15:36

When I receive a message on Facebook I get a push notification on a lock screen (iOS). Then I read this message on desktop. Right after that this push notification disappear

4条回答
  •  执笔经年
    2020-12-07 16:39

    One simple way to achieve this effect is to send a normal push notification to your device with a payload that only contains a badge count of 0.

    In Facebook's example, they clearly have enough server power to simply detect when you've read the message on your desktop and send a push to your devices to makes sure that notification is no longer there.

    I'm not saying this is how FB does it but it's a simpler path that may or may not fit your needs. Keep in mind that background tasking consumes your user's battery significantly and should be avoided when possible.

提交回复
热议问题