Page updated Nov 3, 2023

Remote media

Note: This functionality is not available in tvOS.

APNs supports three types of media: audio, images, and video. You can use a Notification Service Extension to download one of these media types and attach it to an incoming push notification.

AWSPinpointPushNotificationsPlugin provides a service extension that works with Amazon Pinpoint push notifications. You can use the service extension as-is or override certain methods to customize functionality. The following steps describe how to setup the provided Notification Service Extension in your project.

  1. In your Xcode project, select File, New, Target...

New target

  1. Select Notification Service Extension and click Next.

Target type

  1. Enter a name for your service extension and click Finish.

Target name

  1. In project settings, select the service extension target you just added, select the General tab, and add AWSPinpointPushNotificationsPlugin under Frameworks and Libraries.

Add library

  1. When you created the service extension, Xcode created a NotificationService.swift file containing some boiler plate code. Locate this file under the service extension's folder and replace it's contents as show below:

Notification Service

1import AWSPinpointPushNotificationsPlugin
2
3class NotificationService: AWSPinpointPushNotificationsPlugin.ServiceExtension {}

Your service extension is now setup to fetch remote media from a URL defined in Amazon Pinpoint push notifications, save the media to a temporary folder, and attach them to push notifications before they are presented to the user.

APNs supported media types and sizes

Audio - 5MB max

  • AudioInterchangeFileFormat
  • WaveformAudio
  • MP3
  • MPEG4Audio

Image - 10 MB max

  • JPEG
  • GIF
  • PNG

Video - 50 MB max

  • MPEG
  • MPEG2Video
  • MPEG4
  • AVIMovie