Real-Time Triggers 7.x.x

Real-time device triggers are push notifications that are triggered instantly in the device whenever a trigger event(configured while creating the campaign) is tracked with the SDK trackEvent: method. In this case, the notifications are triggered in the device which enables you to post notifications even in offline scenarios.

warning

Note

Real-Time Triggers are available from SDK version 4.0.0

Manual Syncing

MoEngage SDK syncs all the real-time trigger campaigns whenever the app is launched OR comes to the foreground. But in case its needed to manually sync the device triggers for any of the background tasks, use syncRealTimeTriggersWithCompletionBlock: as shown below:

Swift Objective-C
MoEngage.sharedInstance().syncRealTimeTriggers { (rtSyncCompleted) in
            if(rtSyncCompleted){
                print("Real-Time trigger sync successfull")
            }
}

Additional Callbacks for version below iOS 10

warning

Note

For iOS 10 and above, MoEngage SDK uses the UserNotification framework for triggering notifications and rely's on the callbacks from UNUserNotificationCenter to obtain and process the notification payload. Therefore make sure the SDK methods are called in UNUserNotificationCenter delegate callbacks as mentioned in this doc.

For iOS versions below iOS 10 call didReceieveNotificationinApplication: withInfo:openDeeplinkUrlAutomatically: method of MoEngage SDK as shown below.

Swift Objective-C
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
        if let userInfo = notification.userInfo  {
            MoEngage.sharedInstance().didReceieveNotificationinApplication(application, withInfo: userInfo, openDeeplinkUrlAutomatically: true)
        }
}

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?