Overview

Skill Level: Intermediate

The IBM 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.

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 IBMMobilePushNotificationService framework to your notification service target in the XCode project.

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

  3. Add the framework to the notification service target.

    Add the IBMMobilePushNotificationService 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, see Configuring advanced payload options for iOS 10 apps.

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

Go Back to Mobile App Messaging home page.

Join The Discussion

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