Delivery Deferral is now done through IAM Handlers
Starting from versions iOS SDK 5.0.0 and Android SDK 6.0.0, custom delivery deferral is done through IAM Handlers and
In versions iOS SDK 5.0.0 and Android SDK 6.0.0 the functionality explained in this article is no longer supported.
For smooth migration for users already using this and upgrading their SDKs follow the migration articles:
In the Leanplum SDK, we have added the ability for you to custom delay the delivery of the In-App message. Below is more on how we handle In-App messages and how you can defer the message from our original functionality.
In-App messages are attached to the top ViewController. If the current ViewController is used as a splash screen or some other temporary screen, the in-app message will also disappear once that ViewController is dismissed.
For these situations, we have the
Leanplum deferMessagesForViewControllers method, which allows you to specify ViewControllers where In-App messages should not be displayed. When a ViewController is on the deferred list, the in-app message will be displayed on the first available ViewController that is not contained in the list.
If there is more than one In-App message that is deferred, all messages will be shown on the first available ViewController, one after another. The messages will be shown in the order they have been deferred - the 1st deferred message will be shown 1st. The next message will be shown after the 1st message has been dismissed.
Leanplum deferMessagesForViewControllers your iOS SDK version needs to be at least 3.1.0 and you need to add it before Leanplum.start as follows:
We also provide a way to specify which message types should be deferred. Use this if you have defined custom message templates and want to defer them as well. This can be done using the
Leanplum.deferMessagesWithActionNames method before calling
Leanplum.deferMessagesWithActionNames(["Confirm", "Center Popup"])
Leanplum deferMessagesWithActionNames:@[@"Confirm", @"Center Popup"]];
This way only messages of type Confirm and Center Popup will be deferred and not displayed on the provided ViewControllers.
If this method is not called, by default, the Leanplum built-in message types will be included: Alert, Confirm, Center Popup, Web Interstitial, Interstitial, HTML (Rich Interstitial, Banner, Star rating), Push Pre-Permission.
The default message action names can be accessed the following way:
NSArray<NSString*> *defaultNames = [LPDeferMessageManager defaultMessageActionNames];,
let defaultNames = LPDeferMessageManager.defaultMessageActionNames
By default, In-App messages are attached to the current activity. If the current activity is a splash screen or some other temporary screen, the in-app message will also disappear once the current activity is dismissed. For these situations, we have the
LeanplumActivityHelper.deferMessagesForActivities method, which allows you to specify activities where In-App messages should not be displayed. When an activity is on the deferred list, the in-app message will be displayed on the first available activity that is not contained in the list.
LeanplumActivityHelper.deferMessagesForActivities your Android SDK version needs to be at least 1.3.1 and you need to add it before Leanplum.start as follows: