Article

Pushing Updates to Your App Silently

Deliver silent notifications and wake up your app in the background on the user's device.

Overview

If your app’s server-based content changes infrequently, or at irregular intervals, you can use silent notifications to notify your app when new content is available. A silent notification is a remote notification that doesn't display an alert, play a sound, or badge your app’s icon. It wakes your app in the background and gives it time to initiate downloads from your server and update its content.

Enable the Remote Notifications Capability

To receive silent notifications, your app must support the remote notifications background mode. You configure this mode in the Capabilities tab of your project, as shown in Figure 1.

Figure 1

Enabling the remote notifications background mode

Enabling the remote notification background mode in the Capabilities tab of your project.

Create a Silent Notification

To send a silent notification, create a remote notification whose aps dictionary includes only the content-available key, as shown in Listing 1. You may include custom keys in the payload, but the aps dictionary must not contain any keys that would trigger user interactions.

Listing 1

Sample payload for a silent notification

{
   "aps" : {
      "content-available" : 1
   },
   "acme1" : "bar",
   "acme2" : 42
}

When an iOS device receives a silent notification, the system wakes your app in the background and calls the application(_:didReceiveRemoteNotification:fetchCompletionHandler:) method of its app delegate. Your app has 30 seconds of wall-clock time to perform any tasks and call the provided completion handler. For more information, see Handling Notifications and Notification-Related Actions.

See Also

Server Tasks

Generating a Remote Notification

Send notifications to the user’s device with a JSON payload.

Sending Notification Requests to APNs

Send your remote notification payload and device token information to APNs.