For the complete documentation index, see llms.txt. This page is also available as Markdown.

iOS Rich Push Message

This feature is supported in Flutter SDK 2.23.0 and above.

To display push messages with images in an iOS app, add a Notification Service Extension and complete the configuration below.

For more details about iOS Rich Push Notifications, refer to Rich Push Notification.

1

Add Notification Service Extension to App

Open the project by opening /ios/Runner.xcworkspace in Xcode, then select File > New > Target... from the top menu and choose Notification Service Extension as shown below.

Enter an appropriate name and click Finish.

If you are using Swift Package Manager in Flutter, add the Hackle framework to the Extension.

2

Configure Minimum Deployment

The Notification Service Extension requires a minimum supported version separate from the app.

It is recommended to set Minimum Deployment to the same version as the app.

3

Integrate with Hackle SDK

Add Image to Push Message

Add the handleRichNotification function inside the didReceive function to handle push images.

import UserNotifications
import Hackle

class NotificationService: UNNotificationServiceExtension {

    var defaultNotificationContent: UNNotificationContent?
    var contentHandler: ((UNNotificationContent) -> Void)?

    override func didReceive(
      _ request: UNNotificationRequest,
      withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
    ) {
        self.defaultNotificationContent = request.content
        self.contentHandler = contentHandler

        if Hackle.handleRichNotification(request: request, contentHandler: contentHandler) {
            return
        }

        contentHandler(request.content)
    }

    override func serviceExtensionTimeWillExpire() {
      if let contentHandler = contentHandler,
         let defaultNotificationContent = defaultNotificationContent {
            contentHandler(defaultNotificationContent)
        }
    }
}

Last updated