Local In-App Message Delivery

The In-App Message Stack

Showing In-App Messages

When a user is eligible to receive an in-app message, the ABKInAppMessageController will be offered the latest in-app message off the in-app message stack. The stack only persists stored in-app messages in memory and is cleared up between app launches from suspended mode.

Adding In-App Messages to the Stack

Users are eligible to receive an in-app message in the following situations:

Triggered in-app messages are placed on top of the stack when their trigger event is fired. If multiple in-app messages are in the stack and waiting to be displayed, Braze will display the most recently received in-app message first (last in, first out).

Returning In-App Messages to the Stack

A triggered in-app message can be returned back to the stack in the following situations:

  • The in-app message is triggered when the app is in the background
  • Another in-app message is currently visible
  • The deprecated beforeInAppMessageDisplayed:withKeyboardIsUp: UI delegate method has NOT been implemented, and the keyboard is currently being displayed
  • The beforeInAppMessageDisplayed: delegate method or the deprecated beforeInAppMessageDisplayed:withKeyboardIsUp: UI delegate method returned ABKDisplayInAppMessageLater

Discarding In-App Messages

A triggered in-app message will be discarded in the following situations:

  • The beforeInAppMessageDisplayed: delegate method or the deprecated beforeInAppMessageDisplayed:withKeyboardIsUp: UI delegate method returned ABKDiscardInAppMessage
  • The asset (image or zip file) of the in-app message failed to download
  • The in-app message is ready to be displayed but past the timeout duration
  • The device orientation doesn’t match the triggered in-app message’s orientation
  • The in-app message is a full in-app message but has no image
  • The in-app message is a image-only modal in-app message but has no image

Manually Queue In-App Message Display

If you wish to display an in-app message at other times within your app, you may manually display the top-most in-app message on the stack by calling the following method:

1
2
[[Appboy sharedInstance].inAppMessageController displayNextInAppMessageWithDelegate:YOUR_IN_APP_MESSAGE_DELEGATE]
// YOUR_IN_APP_MESSAGE_DELEGATE should be replaced with your in-app message controller delegate, if you have implemented one.

Real Time In-App Message Creation & Display

In-app messages can also be locally created within the app and displayed via Braze. This is particularly useful for displaying messages that you wish to trigger within the app in real-time. Braze does not support analytics on in-app messages created locally.

1
2
3
4
5
6
7
- (IBAction)createAndDisplayACustomInAppMessage:(id)sender {
  ABKInAppMessageSlideup *customInAppMessage = [[ABKInAppMessageSlideup alloc] init];
  customInAppMessage.message = @"YOUR_CUSTOM_SLIDEUP_MESSAGE";
  customInAppMessage.duration = 2.5;
  customInAppMessage.extras = @{@"key" : @"value"};
  [[Appboy sharedInstance].inAppMessageController addInAppMessage:customInAppMessage];
}
WAS THIS PAGE HELPFUL?
New Stuff!