Deliver relevant, personalized messages to your app’s users with in-app messaging. You can now send messages without relying on users having enabled push notifications. Engaging full-screen, modal, or banner messages are presented while your users are interacting with your app.
To ensure that your app has the latest message data, in-app messages are loaded each time your app comes to the foreground. When your app comes into the foreground, any messages marked for display are prepared to be presented at the top of your app’s view stack. Only one message is displayed each time the app comes into the foreground. Depending on how your app is enabled, the SDK can be triggered to download in-app messages in the background.
You can fully enable in-app messages in Marketing Cloud Journey Builder. To use certain in-app messaging functionality, such as button actions, some SDK configuration is required.
Required Methods for Button Actions
Marketers can configure the action that occurs when an end-user taps a button on an in-app message. Actions for Notification Settings and Location Settings are handled by the SDK, while actions for Web URL and App URL require that you implement a new SDK initialization method, as shown in the following example.
You can use the SDK’s optional in-app messaging EventListener to control aspects of message display and to get information about the in-app message display lifecycle.
didShowMessage and didCloseMessage
The following delegate 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 in your app’s activity stack. Your app may need to respond to a view appearing or disappearing.
didShowMessage is called when the in-app message is initially presented.
didCloseMessage is called after the user performs closes the message.
Prevent or Delay Message Display
You can delay or prevent an in-app message’s display. For example, prevent an in-app message from displaying during loading, instructions, the sign-in flow, and other situations. To prevent display of the message, make the shouldShowMessage method return false.
You can capture the message data and show that message later. For example, present the message after the end-user has signed in. Capture the ID of the message and show that message later.
In-app messages use your device’s system font. You can override the default font face to customize the display of an in-app message title, body, and button labels.
You can’t alter the font size because this is defined by the message’s design.
To set the display font, pass the SDK a valid TypeFace for the device’s installed fonts or your app’s custom fonts via the following method.
The SDK can’t use AppCompatActivity and can’t inherit your app’s status bar color. Instead, set a custom status bar color in your app’s theme. The SDK applies this color on Android API versions that support status bar color, which is Lollipop and newer.