Setting delegates
In-app message display and delivery customizations can be accomplished in code by setting our optional delegates.
In-app message delegate
The ABKInAppMessageUIDelegate
delegate can be used to receive triggered in-app message payloads for further processing, receive display lifecycle events, and control display timing.
Set your ABKInAppMessageUIDelegate
delegate object on the Braze instance by calling:
1
[[Appboy sharedInstance].inAppMessageController.inAppMessageUIController setInAppMessageUIDelegate:self];
1
Appboy.sharedInstance()?.inAppMessageController.inAppMessageUIController?.setInAppMessageUIDelegate?(self)
Check out our in-app message sample app for an example implementation. Note that if you are not including Braze’s UI library in your project (uncommon), this delegate is unavailable.
Core in-app message delegate
If you are not including Braze’s UI library in your project and would like to receive triggered in-app message payloads for further processing or custom display in your app, implement the ABKInAppMessageControllerDelegate
protocol.
Set your ABKInAppMessageControllerDelegate
delegate object on the Braze instance by calling:
1
[Appboy sharedInstance].inAppMessageController.delegate = self;
1
Appboy.sharedInstance()?.inAppMessageController.delegate = self
You can alternatively set your core in-app message delegate at initialization time via appboyOptions
using the key ABKInAppMessageControllerDelegateKey
:
1
2
3
4
[Appboy startWithApiKey:@"YOUR-API_KEY"
inApplication:application
withLaunchOptions:options
withAppboyOptions:@{ ABKInAppMessageControllerDelegateKey : self }];
1
2
3
4
Appboy.start(withApiKey: "YOUR-API-KEY",
in:application,
withLaunchOptions:launchOptions,
withAppboyOptions:[ ABKInAppMessageControllerDelegateKey : self ])
Method declarations
For additional information, see the following header files:
Implementation samples
See ViewController.m
in the in-app message sample app.