Push

Before you start

You must first consent to receive channel notifications for the action you wish to use through your user profile settings.

To use push messages, please register the .p8 APNs authentication key issued by Apple in the DFINERY console. You can register it in the console's Additional Settings / Channel Additional Settings / Push / iOS Settings Management.

SDK Integration

Add the push token registration code to the AppDelegate class.

import UIKit
import UserNotifications

import DfinerySDK

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        ...
        ...
        application.registerForRemoteNotifications()
        ...
        ...
    }

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        
        Dfinery.shared().set(pushToken: deviceToken)

    }

}

Example Code

Push handling

For push handling, please adopt the UNUserNotificationCenterDelegate protocol in your AppDelegate class and integrate the SDK code.

Service Extension

To use images and buttons in DFINERY Push, you must additionally create a Notification Service Extension and integrate DfineryServiceExtension.

Last updated