Documentation > iOS

iOS 10 Rich Push Notifications

iOS 10 has introduced Rich Push Notifications, which allow you to add image, video, audio or gif attachments to your push notifications.

Rich Push Notifications are enabled via a Notification Service Extension, a separate and distinct binary embedded in your app bundle. Prior to displaying a new push notification, the system will call your Notification Service Extension to allow you to modify the payload as well as add media attachments to be displayed.

First, enable push notifications for your app.

Second, create a Notification Service Extension in your project. To do that, in Xcode, select File -> New -> Target and choose the Notification Service Extension template.

service_extension

Then, when sending notifications via APNS:
– include the mutable-content flag in your aps payload (this key must be present in the aps payload or the system will not call your app extension)
– add custom key-value pair(s) to the payload with the necessary data to construct the download url for the media you want to display (your app extension code will then read these key-value pairs to initiate the media download on the device). Apple supports images, video, audio and gif.

When using the CleverTap Dashboard to send push:
– select Advanced
– set the mutable-content flag check box
– add your key-value pair(s).

push_dashboard

When using the CleverTap Server API to send push: include "mutable-content": "true" in the platform_specific: ios section of the request payload.

See an example Swift project here.

See an example Objective-C project here.