Skip to content

Delivery improvements and rich content notifications

Alexander Boldyrev edited this page Oct 31, 2024 · 5 revisions

Setting up iOS part

With the new iOS 10 you can attach a static or animated (GIF) image (see Rich Notifications for more details), or even a video to push notifications as well as modify the notification content prior to show it to the user. But what is more important for us is that with the Notification Service Extensions we can run arbitrary code in background even if your main application is killed by the user. This feature gives us an opportunity to improve message handling and delivery reporting. In this tutorial you will learn how to integrate the Notification Service Extension with your existing application.

Requirements

  • Ruby 2.3.8 to run "mmine" command.
  • iOS deployment target not lower than 10.0

Setting up App Group ID for an App ID

As a prerequisite, you need to register a new App Group with a unique App Group Id on this site: https://developer.apple.com/account/ios/identifier/applicationGroup. The App Group is needed for your application and notification extension to exchange important data via shared data container, remember this ID for further integration steps.

Setting up Xcode project

  1. Install and run Ruby Gem mmine, passing appropriate parameters:

    $ sudo gem install mmine
    $ mmine integrate \
    --application-code <your Push Application Code from Infobip portal> \
    --project <absolute path to your Xcode project (.xcodeproj file)> \
    --app-group <your App Group Id from previous section> \
    --target <name of your projects main target> \
    --static-linkage \
    --react-native

    This tool will automatically integrate Mobile Messaging Notification Extension into your Xcode project. Your Application Code will be automatically injected into NotificationService.swift source file as a hardcoded string parameter for MobileMessagingNotificationServiceExtension.startWithApplicationCode(_) method call.

Notice

Linking of the MobileMessaging static library is supported starting from 6.2.0 version of the plugin, for the lower plugin versions --static-linkage parameter shouldn't be provided into the mmine integrate command and use_frameworks! should be added to the Podfile

  1. Add settings for MobileMessagingNotificationExtension target to your Podfile as follows:

    Notice

    • Further steps applicable if you use Cocoapods to integrate MobileMessaging SDK. If you use Carthage, next steps are on Integration via Carthage page.
    • It's strongly recommended to have the latest version of CocoaPods.
    target 'YourProjectsMainTarget' do
        ...
         
        target 'MobileMessagingNotificationExtension' do
            inherit! :search_paths
        end
    end
  2. Run pod update from Terminal, from the ios folder

Troubleshooting and Customising Push Notification Content

Sending content

In order to receive media content through Push messages, you need to create a new campaign on Customer portal or send a message through Push HTTP API

Rich notification - CUP - step 1 Rich notification - CUP - step 2 Rich notification - CUP - step 3

Receiving on Android

Provided image will be displayed in the notification drawer where default rich notification’s design correlates with OS version. As of API 16 - Jelly Bean, image downloaded from provided URL will be displayed not only in normal view, but also in expanded, big view.

Rich notification - Android 7.1 Rich notification - Android 4.4
Preview of rich notifications on Android 7.1 and Android 4.4

Receiving on iOS

Provided content will be displayed on devices with iOS 10.+ in the notification center.

Rich notification - iOS10
Clone this wiki locally