Implement In-App Messaging on Android

To use certain in-app messaging features, such as button actions, some SDK configurations are needed. The following sections describe these configurations.

Marketers can configure the action that occurs when an end user taps a button on an in-app message. The SDK handles actions for Notification Settings and Location Settings, while actions for Web URL and App URL require that you implement UrlHandler as a new SDK initialization method.

The following example shows how you can configure the SDK to handle button clicks in in-app messages.

To control aspects of message display and to get information about the in-app message display lifecycle, use the SDK’s optional in-app messaging EventListener

After the SDK’s initialization is complete, you can register your in-app message EventListener with InAppMessageManager.

The didShowMessage and didCloseMessage callback methods help ensure that you can appropriately manage your app’s view state. In-app messages are shown in an activity controlled by the SDK within your app’s activity stack. Your app is required to respond to a view appearing or disappearing.


didShowMessage is invoked when the in-app message is initially presented.


didCloseMessage is invoked after the user closes the message.

You can delay or prevent an in-app message’s display. For example, you can choose to prevent an in-app message from displaying during the loading process, sign-in flow, and other situations. To prevent or delay message display, set the shouldShowMessage method to return false.

Furthermore, you can capture data of any in-app message and use it for displaying the specific message at a later time. For example, you can present the message after an end user has successfully signed in by capturing the ID of the message and showing that message later, as shown in the following example.

By default, in-app messages use your device’s system font. However, you can override the default font face to customize the appearance of an in-app message's title, body, and button labels.

You can’t alter the font size since the message’s design defines it.

To set the display font, pass the SDK a valid TypeFace for the device’s installed fonts, or your app’s custom fonts as shown in the following example.

The SDK doesn’t use AppCompatActivity and can’t inherit your app’s status bar color automatically. Instead, you must define a custom status bar color. The SDK applies this color on Android API versions that support the status bar color, which is Lollipop and newer.