MoEngageSDKMessaging
@objc
public class MoEngageSDKMessaging : NSObject
Class responsible for Push integration
-
Singleton instance
Declaration
Swift
@objc public static let sharedInstance: MoEngageSDKMessaging
-
Requests the user’s authorization to allow local and remote notifications for your app.
Declaration
Swift
@available(tvOS, unavailable) @available(iOSApplicationExtension, unavailable) @objc public func registerForRemoteNotification(withCategories categories: Set<UNNotificationCategory>? = nil, andUserNotificationCenterDelegate delegate: UNUserNotificationCenterDelegate? = nil)Parameters
categoriesA type of notification your app supports and the custom actions that the system displays.
delegateThe interface for handling incoming notifications and notification-related actions.
-
Method to register for provisional push permission.
Declaration
Swift
@available(iOS 12.0, *) @available(tvOS, unavailable) @objc public func registerForRemoteProvisionalNotification( withCategories categories: Set<UNNotificationCategory>? = nil, andUserNotificationCenterDelegate delegate: UNUserNotificationCenterDelegate? = nil)Parameters
categoriesA type of notification your app supports and the custom actions that the system displays.
delegateThe interface for handling incoming notifications and notification-related actions.
-
Method to add the notification categories to the existing list of
MOE_DISMISS_CATEGORYandMOE_PUSH_TEMPLATEcategory.Declaration
Swift
@available(tvOS, unavailable) @objc public func setUserNotificationCategories(_ categories: Set<UNNotificationCategory>? = nil)Parameters
categoriesSet of categories.
-
Set the delegate inorder to receive the notification related callbacks
Declaration
Swift
@available(tvOS, unavailable) @objc public func setMessagingDelegate(_ delegate: MoEngageMessagingDelegate?)Parameters
delegateInstance that conforms to
MoEngageMessagingDelegateprotocol. -
Set the delegate inorder to receive the notification related callbacksfor Secondary MoEngage Instance.
Declaration
Swift
@available(tvOS, unavailable) @objc public func setMessagingDelegate(_ delegate: MoEngageMessagingDelegate?, forAppID appID: String? = nil)Parameters
delegateInstance that conforms to
MoEngageMessagingDelegateprotocol.appIDMoEngage Account Identifier
-
In case you have disabled swizzling, call this method to pass the device token to MoEngage SDK
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func setPushToken(_ deviceToken: Data?)Parameters
deviceTokenIdentifier for the Apple Push Notification System
-
In case you have disabled swizzling, call this method when notification registration fails
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func didFailToRegisterForPush() -
In case you have disabled swizzling, call this method on receiving the notification
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification)Parameters
centerThe central object for managing notification-related activities for your app or app extension.
notificationThe data for a local or remote notification the system delivers to your app.
-
In case you have disabled swizzling, call this method on performing any action the notification
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse)Parameters
centerThe central object for managing notification-related activities for your app or app extension.
responseThe user’s response to an actionable notification.
-
Method to disable badge reset by SDK
Declaration
Swift
@available(tvOS, unavailable) @objc public func disableBadgeReset(_ disable: Bool)Parameters
disablePass true to disable badge reset
-
Track notification received impression
Declaration
Swift
@available(tvOS, unavailable) @available(*, deprecated, message: "This method is deprecated in favour of method with completion handler. This method would be removed in future major version of the SDK.") @objc public func logNotificationReceived(withPayload payload: [AnyHashable : Any])Parameters
payloadAPNS notification payload
-
Track notification received impression
Invoke the service extension content handler callback after the impression track is completed.
Declaration
Swift
@available(tvOS, unavailable) @objc public func logNotificationReceived(withPayload payload: [AnyHashable : Any], completion: @escaping () -> Void)Parameters
payloadAPNS notification payload
completionCallback when notification received impression track completed.
-
Track notification click impression
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func logNotificationClicked(withPayload payload: [AnyHashable : Any])Parameters
payloadAPNS notification payload
-
Validate if the notification belongs to MoEngage
Declaration
Swift
@available(tvOS, unavailable) @objc public func isPushFromMoEngage(withPayload payload: [AnyHashable : Any]) -> BoolParameters
payloadAPNS notification payload
Return Value
true if notification belongs to MoEngage else false.
-
Navigate to push permission settings page
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @objc public func navigateToPushSettings()