Push notifications that trigger a background refresh before showing the push notification VS silent push Push notifications that trigger a background refresh before showing the push notification VS silent push ios ios

Push notifications that trigger a background refresh before showing the push notification VS silent push


I've been struggling with the same task in my messaging app. We wanted users to see the message right before user taps the notification. What we faced with:

  • The payload size limitation. iOS 7 can have only 256 bytes for payload
  • single silent notifications will not start an app, if it is not running
  • content-available notifications without alert body may even not be delivered to the device
  • Background fetch is not controlled by your app, so you may never receive the desired signal, so we cannot rely on this feature. But this may be helpful as an additional way to achieve what we want
  • iOS 8 has a lot of space for payload - 2KB
  • if you send alert body and content-available - it will be delivered in most cases and an app is able to process it

So we came to the only acceptable solution: we decided to make this feature in ios8+ only. We send visible push notifications with content-available key which allows us to process the notification payload if the process is running/frozen and both be able to present the notification if the app is not running. If an app receives push notification, it takes alert text body and writes it into local database, so the user is able to read it in conversation. According to our stats, the average size of the message is not more than 200 symbols, so most of the time no extra requests are required. If the message is longer than 200 symbols, we extend payload body with extra parameter which is used to request text body in push notification processing. The user will see a cropped version of text, but after a request is done, we rewrite a message in local database with the received value.

So, that technique allows us to show a received message to the user immediately in most of the cases + if the app was not running, we make a request to our server to fetch missing messages right after application start. This is the fastest and the most acceptable case we could get on iOS. Hope my experience will help you to implement what you want.


You mixed a few of things together.

From a quick look at your link, this is a guide for xamarin. There might be some correct info there but if you are not using xamarin I'd search for another tutorial.

A good approach would be to send a silent notification to the user and triggering a local notification when it's done (which is not hacky at all).

This is how whatsApp is making it work:

While whatsApp is in the background, a single push notification is received, (for example "5") That msg will not be shown to the user.

whatsApp receives it in the method application:didReceiveRemoteNotification:fetchCompletionHandler: and checks against their servers if there are any notifications prior to "5" that the user didn't receive. If that's the case, they will pull that data from their servers and will present it to the user using local notifications which is basically just a way to present data and not related to APNS at all.

You can read the full answer & context in another answer I wrote here