Rich Notifications

Rich Notifications

Rich Notifications is a notification type which supports image, gif, video content. D·engage SDK supports varieties of contents and handles notification.

Supports:

  • Image
  • Video
  • Gif

To support Rich Notifications, application needs to create Notification Service Extension.

on Android, there is no special setup required for rich notifications.

Referrer: Apple Doc

Referrer: Supported File Types

Setup

Adding Notification Service Extension

1.1 In Xcode Select File > New > Target

1.2 Select Notification Service Extension then press Next.

1.3 Enter the product name as DengageNotificationServiceExtension and press Finish.

1.4 Press Cancel on the Activate scheme prompt.

1.5 Open NotificationService.swift and replace the whole file contents with the below code.



import UserNotifications
import Dengage

class NotificationService: UNNotificationServiceExtension {

var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?

override func didReceive(
_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

if #available(iOS 15.0, *) {
bestAttemptContent?.interruptionLevel = .timeSensitive
} else {
// Fallback on earlier versions
}

Dengage.didReceiveNotificationRequest(
bestAttemptContent,
withContentHandler: contentHandler
)
}

override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
contentHandler(bestAttemptContent)
}
}
}

1.6 It should be added to the PodFile.

target 'DengageNotificationServiceExtension' do
pod 'Dengage', :git => 'https://github.com/dengage-tech/dengage-ios-sdk.git', :branch => 'version/5.54.1'

end
    • Related Articles

    • Flutter

      dengage_flutter Installation a) Edit your project's pubspec.yaml file to include the dengage_flutter SDK: Shell dependencies: 1.1.1 b) Run flutter pub get to install the SDK. Platform Specific Extra Steps Following extra steps after the installation ...
    • Migration From Old Dengage Sdk

      Class Imports You can change class imports with respect to table below. Old Sdk New Sdk com.dengage.sdk.DengageLifecycleTracker com.dengage.sdk.util.DengageLifecycleTracker com.dengage.sdk.NotificationReceiver ...
    • Intro

      D·engage Mobile SDK enables you Mobile Device Subscription to D·engage Platform Mobile Notification Registration Mobile Notification Display (Text, Rich, Causel Mobile Push Messages) Tracking Mobile Pushes like Click events Tracking Marketing Events ...
    • Silent Push

      Silent push notifications allow background updates without interrupting the user. They are automatically handled within the SDK but can be customized for specific use cases. Android SDK Default Handling Silent push notifications are automatically ...
    • iOS

      License This part explains the iOS part of the Mobile SDK. If you are using D·engage iOS SDK version lower than 5.0.0 Dengage.Framework provides necessary classes and functions which handles. To use version 5.0.0 Dengage provides necessary classes ...