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
categories
A type of notification your app supports and the custom actions that the system displays.
delegate
The 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
categories
A type of notification your app supports and the custom actions that the system displays.
delegate
The interface for handling incoming notifications and notification-related actions.
-
Method to add the notification categories to the existing list of
MOE_DISMISS_CATEGORY
andMOE_PUSH_TEMPLATE
category.Declaration
Swift
@available(tvOS, unavailable) @objc public func setUserNotificationCategories(_ categories: Set<UNNotificationCategory>? = nil)
Parameters
categories
Set of categories.
-
Set the delegate inorder to receive the notification related callbacks
Declaration
Swift
@available(tvOS, unavailable) @objc public func setMessagingDelegate(_ delegate: MoEngageMessagingDelegate?)
Parameters
delegate
Instance that conforms to
MoEngageMessagingDelegate
protocol. -
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
delegate
Instance that conforms to
MoEngageMessagingDelegate
protocol.appID
MoEngage 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
deviceToken
Identifier 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
center
The central object for managing notification-related activities for your app or app extension.
notification
The 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
center
The central object for managing notification-related activities for your app or app extension.
response
The 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
disable
Pass true to disable badge reset
-
Track notification received impression
Declaration
Swift
@available(tvOS, unavailable) @objc public func logNotificationReceived(withPayload payload: [AnyHashable : Any])
Parameters
payload
APNS notification payload
-
Track notification click impression
Declaration
Swift
@available(iOSApplicationExtension, unavailable) @available(tvOS, unavailable) @objc public func logNotificationClicked(withPayload payload: [AnyHashable : Any])
Parameters
payload
APNS notification payload
-
Validate if the notification belongs to MoEngage
Declaration
Swift
@available(tvOS, unavailable) @objc public func isPushFromMoEngage(withPayload payload: [AnyHashable : Any]) -> Bool
Parameters
payload
APNS 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()