Overview

Skill Level: Intermediate

The Mobile app messaging plug-in for Cordova supports media attachments in notifications for iOS applications. When a user on an iOS device receives a notification with a media attachment from the APNS service, the incoming notification is processed before it is displayed to the user. First, the URL for the media attachment is extracted, and then the media file is downloaded and attached to the notification.

Prerequisites

Not what you’re looking for? Check out all of our available tutorials for mobile app messaging here.

Step-by-step

  1. Set a Target in your XCode project.

    In your XCode project, go to the File menu and select New > Target. A dialog box opens.

  2. Set the target to iOS.

    Add the AcousticMobilePushNotificationService framework to your notification service target in the XCode project.

    The AcousticMobilePushNotificationService framework is located in the plugins/ios-notification-service folder.

  3. Add the framework to the notification service target.

    Add the AcousticMobilePushNotificationService framework to your notification service target in the XCode project.

  4. Remove methods and change the superclass in the provided MCENotificationService class.

    Remove methods in the UNNotificationServiceExtension subclass and change the superclass to the provided MCENotificationService class.

  5. Add the MceConfig.json file to the Notification Service target

    Open the MceConfig.json file and check the Notification Service target membership in the Target Membership of the File Inspector in the right Xcode pane.

  6. Add -ObjC to the Other Linker Flags build options for the Notification Service

Expected outcome

To add media attachments to notifications, you must configure the mutable-content flag and media-attachment key in the iOS 10 payload. For more information, refer to the following articles: 

For information about other mobile app messages features, see the Documentation.

 

Need more help? Check out all of our available tutorials for mobile app messaging here.

Join The Discussion

Your email address will not be published. Required fields are marked *