swalkner
swalkner

Reputation: 17359

How does WhatsApp handle silent push notifications on iOS when app was killed by user?

From what I've learned, silent push notifications do not call application:didReceiveRemoteNotification:fetchCompletionHandler: when the user killed the app via multitasking UI. But when looking at WhatsApps behavior, I do not understand how they manage to do the following:

this means that WhatsApp somehow manages it to handle the receiption of the push notification although the app is killed. Does anyone have an idea how? With .badge, .alert, ...?

Upvotes: 4

Views: 1339

Answers (1)

Christos Koninis
Christos Koninis

Reputation: 1688

There are other methods to update your application. One other way is using background app refresh. Background App Refresh lets your app run periodically in the background so that it can update its content.

--Edit for adding other possible methods:--

An other way that can be used for a short period(fixed length time) after the app has been killed is by asking for background execution time. This can give the app more running time.

For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background. For example Apps that support Voice over Internet Protocol (VoIP) or Apps that Acts as a Bluetooth LE accessory.

--Edit #2 --

It seems from the info.plist of the WhatsApp application that it uses multiple UIBackgroundModes, any of them can be used to wake/keep the app in the background.

portion of info.plist of the WhatsApp:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>fetch</string>
    <string>remote-notification</string>
    <string>voip</string>
</array>

Upvotes: 1

Related Questions