简体   繁体   中英

How does FB messenger removes push notification from iOS app when I see the message on FB Desktop?

Whenever I get a notification about a message on my iPhone from Facebook and I reply to that message from Facebook website, that push notification goes away from my iPhone home screen. How is Facebook doing that? I know push notification don't have delivery confirmation mechanism in iOS. Here in this scenario Facebook knows I have read the message so are they pushing something to their app to remove notification? Even if they're sending a message to their app that I have read this message how is app removing that notification when I don't have background app refresh enabled for FB messenger or FB iOS app.

What you do is after you've sent the notification you want to remove, you send a notification with the message="" and badge=0. I just tested this in a node js application and it removed the previous notification like you are saying.

After testing myself as following, the answer by SnoApps is correct. The tests I described below assumes the account on iPhone is A.

Test 1: - Send message 1 from B to A => notification shown on iPhone - A reads message 1 on desktop => notification on iPhone is gone

Test 2: - Send message 1 from B to A => notification shown on iPhone - Send message 2 from C to A => another notification shown - A reads message 1 on desktop => both notifications still exist - A reads message 2 on desktop => both notifications gone

And I tested WhatsApp and WeChat, all of them using similar way to do this, which is when server count of unread messages becomes 0, send a silent notification with an empty body and badge 0 to iPhone. the iOS will clear the banners for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM