iosnotificationspush-notificationapple-push-notifications

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


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 without any interactions with the phone. How can I implement the same thing myself for removing outdated notifications?

The second usage could be stitching notifications together. For instance Instagram sends you a push when someone liked your photo. After 20 likes your notifications screen is ruined and unreadable. But using the same principal as Facebook does it seem to be possible remove previous notification of the same sort and create new with the increased counter. No "User A liked photo X, User B liked photo Y etc", but "20 users liked photo Z" instead.

I've seen couple of treads on similar topics here, but still no answer so far. Thanks!


Solution

  • See the Multitasking Enhancements and the silent push notifications in particular. Using the silent push you can notify your app that new content is available and also download that content and/or set the badge number for example without displaying the notification in the "Notification Center". You'll have to set the UIBackgroundModes with the remote-notification value in order to make this work.

    You can send silent push if the user has seen the content on another platform and clear the badge number on your iOS app.