open class BrazeInAppMessageManager : InAppMessageManagerBase

This class is used to display in-app messages that are either sent from Braze or are created natively in the host app. It will only show one in-app message at a time and will place all other in-app messages onto a stack. The BrazeInAppMessageManager will also keep track of in-app impressions and clicks, which can be viewed on the dashboard.

If there is already an in-app message being displayed, the new in-app message will be put onto the top of the stack and can be displayed at a later time. If there is no in-app message being displayed, then the beforeInAppMessageDisplayed will be called. The InAppMessageOperation return value can be used to control when the in-app message should be displayed. A suggested usage of this method would be to delay in-app message messages in certain parts of the app by returning DISPLAY_LATER when in-app message would be distracting to the users app experience. If the method returns DISPLAY_NOW then the in-app message will be displayed immediately. The onInAppMessageClicked and onInAppMessageDismissed methods can be used to override the default click and dismiss behavior. By default, in-app messages fade in and out from view. The slideup type of in-app message slides in and out of view can be dismissed by swiping the view horizontally. If the in-app message's DismissType is set to AUTO_DISMISS, then the in-app message will animate out of view once the set duration time has elapsed. In order to use a custom view, you must create a custom view factory using the setCustomInAppMessageViewFactory method. A new in-app message android.view.View object is created when a in-app message is displayed and also when the user navigates away to another This happens so that the Activity can be garbage collected and does not create a memory leak. For that reason, the registerInAppMessageManager and unregisterInAppMessageManager must be called in the Activity.onResume() and Activity.onPause() methods of every Activity.


Link copied to clipboard
open fun addInAppMessage(inAppMessage: IInAppMessage)
Provides a in-app message that will then be handled by the in-app message manager.
Link copied to clipboard
open fun displayInAppMessage(inAppMessage: IInAppMessage, isCarryOver: Boolean)
Internal method, do not call as part of an integration!
Link copied to clipboard
open fun ensureSubscribedToInAppMessageEvents(context: Context)
Ensures the InAppMessageManager is subscribed in-app message events if not already subscribed.
Link copied to clipboard
open fun getActivity(): Activity
Link copied to clipboard
open fun getApplicationContext(): Context
Link copied to clipboard
open fun getCarryoverInAppMessage(): IInAppMessage
An In-App Message being carried over during the unregisterInAppMessageManagerregisterInAppMessageManager transition.
Link copied to clipboard
A IInAppMessageManagerListener to be used only for control in-app messages.
Link copied to clipboard
open fun getDefaultInAppMessageViewFactory(inAppMessage: IInAppMessage): IInAppMessageViewFactory
Gets the default IInAppMessageViewFactory as returned by the BrazeInAppMessageManager for the given IInAppMessage.
open fun getDoesBackButtonDismissInAppMessageView(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun getInAppMessageAnimationFactory(): IInAppMessageAnimationFactory
Link copied to clipboard
open fun getInAppMessageManagerListener(): IInAppMessageManagerListener
Link copied to clipboard
open fun getInAppMessageStack(): Stack<IInAppMessage>
The stack of In-App Messages waiting to be displayed.
Link copied to clipboard
open fun getInAppMessageViewFactory(inAppMessage: IInAppMessage): IInAppMessageViewFactory
Link copied to clipboard
Link copied to clipboard
open fun getInstance(): BrazeInAppMessageManager
Link copied to clipboard
open fun getIsCurrentlyDisplayingInAppMessage(): Boolean
Gets whether an in-app message is currently displaying on the device.
Link copied to clipboard
open fun getUnregisteredInAppMessage(): IInAppMessage
An In-App Message that could not display after a call to requestDisplayInAppMessage due to no Activity being registered via registerInAppMessageManager
Link copied to clipboard
open fun hideCurrentlyDisplayingInAppMessage(dismissed: Boolean)
Hides any currently displaying in-app message.
Link copied to clipboard
open fun isActivitySet(): Boolean
Link copied to clipboard
open fun registerInAppMessageManager(activity: Activity)
Registers the in-app message manager, which will listen to and display incoming in-app messages.
Link copied to clipboard
open fun requestDisplayInAppMessage(): Boolean
Asks the InAppMessageManager to display the next in-app message if one is not currently being displayed.
Link copied to clipboard
open fun resetAfterInAppMessageClose()
Resets the BrazeInAppMessageManager to its original state before the last in-app message was displayed.
Link copied to clipboard
open fun setBackButtonDismissesInAppMessageView(backButtonDismissesInAppMessageView: Boolean)
Sets whether the hardware back button dismisses in-app messages.
open fun setClickOutsideModalViewDismissInAppMessageView(doesDismiss: Boolean)
Sets whether the tapping outside the modal in-app message content dismiss the message.
open fun setCustomControlInAppMessageManagerListener(inAppMessageManagerListener: IInAppMessageManagerListener)
Assigns a custom IInAppMessageManagerListener that will be used when displaying control in-app messages.
Link copied to clipboard
open fun setCustomHtmlInAppMessageActionListener(htmlInAppMessageActionListener: IHtmlInAppMessageActionListener)
Assigns a custom IHtmlInAppMessageActionListener that will be used during the display of Html in-app messages.
Link copied to clipboard
open fun setCustomInAppMessageAnimationFactory(inAppMessageAnimationFactory: IInAppMessageAnimationFactory)
Assigns a custom IInAppMessageAnimationFactory that will be used to animate the in-app message View.
Link copied to clipboard
open fun setCustomInAppMessageManagerListener(inAppMessageManagerListener: IInAppMessageManagerListener)
Assigns a custom IInAppMessageManagerListener that will be used when displaying in-app messages.
Link copied to clipboard
open fun setCustomInAppMessageViewFactory(inAppMessageViewFactory: IInAppMessageViewFactory)
Assigns a custom IInAppMessageViewFactory that will be used to create the in-app message View.
Link copied to clipboard
open fun setCustomInAppMessageViewWrapperFactory(@Nullable() inAppMessageViewWrapperFactory: IInAppMessageViewWrapperFactory)
Sets a custom IInAppMessageViewWrapperFactory that will be used to display an IInAppMessage to the user.
Link copied to clipboard
open fun unregisterInAppMessageManager(activity: Activity)
Unregisters the in-app message manager.