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.
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).