In-App Experiences for the Android SDK
Integrate Scenes & In-App Automations into your Android app to display embedded content and create custom in-app experiences with minimal code.
In-App Experiences use Airship’s on-device automation framework to provide instant, personalized content that integrates natively with your app. This includes ScenesA mobile app or web experience of one or more screens displayed with fully native UI components in real time, providing immediate, contextual responses to user behaviors. Scenes can be presented in full-screen, modal, or embedded format using the default swipe/click mode or as a Story. They can also contain survey questions., which can be displayed as modal or fullscreen overlays or embedded directly within your app screens, and In-App Automations (IAA), which power banner, modal, and fullscreen in-app messages triggered by events.
Scenes are fully customizable in the Airship dashboard and require minimal SDK integration. For advanced In-App Automation customization options, see In-App Automation.
Requirements
To use In-App Experiences, you need:
- The
urbanairship-automationmodule installed (see Getting Started) - Airship SDK initialized (see Getting Started)
In-App Experiences work out of the box: Once you install the urbanairship-automation module and initialize Airship, In-App Experiences will function automatically. The rest of this documentation covers optional customization and advanced features.
Controlling display
Control when and how In-App Experiences are displayed in your app. You can manually pause all in-app displays, set intervals between displays, and control when individual messages are ready to display.
Pausing display
Pausing will still allow In-App Experiences to be triggered and queued up for execution, but they will not display. This is useful for preventing in-app experiences from displaying on screens where it would be detrimental to the user experience, such as splash screens, settings screens, or landing pages.
Pausing display
InAppAutomation.shared().isPaused = trueInAppAutomation.shared().setPaused(true);Display interval
The display interval controls the amount of time to wait before the manager can display the next triggered In-App Experience. The default value is set to 0 seconds and can be adjusted to any amount of time in seconds.
Display interval
InAppAutomation.shared().inAppMessaging.displayInterval = 30InAppAutomation.shared().getInAppMessaging().setDisplayInterval(30);Controlling per-message display
You can control when individual In-App Experiences are ready to display and listen for when they are displayed or finished. This is useful when you need to check app state before displaying content, such as:
- Verifying the current Activity is appropriate for the message
- Checking custom data in the message’s extras (custom keys) to determine if it should display
- Ensuring certain app conditions are met before showing the message
- Integrating with other in-app messaging products
Controlling per message display
Set a delegate to control the display. You have access to the message and schedule ID:
InAppAutomation.shared().inAppMessaging.displayDelegate = object : InAppMessageDisplayDelegate {
override fun isMessageReadyToDisplay(message: InAppMessage, scheduleId: String): Boolean {
// Return false to prevent display
return false
}
override fun messageWillDisplay(message: InAppMessage, scheduleId: String) {
// Message displayed
}
override fun messageFinishedDisplaying(message: InAppMessage, scheduleId: String) {
// Message finished
}
}isMessageReadyToDisplay will be called whenever state in the app changes (Activity, app state, message finished displaying, etc…), you can also trigger it manually with notifyDisplayConditionsChanged:
InAppAutomation.shared().inAppMessaging.notifyDisplayConditionsChanged()Implement the InAppMessageDisplayDelegate to control the display. You have access to the message and schedule ID:
InAppAutomation.shared().getInAppMessaging().setDisplayDelegate(new InAppMessageDisplayDelegate() {
@Override
public boolean isMessageReadyToDisplay(@NonNull InAppMessage message, @NonNull String scheduleId) {
// Return false to prevent display
return false;
}
@Override
public void messageWillDisplay(@NonNull InAppMessage message, @NonNull String scheduleId) {
// Message displayed
}
@Override
public void messageFinishedDisplaying(@NonNull InAppMessage message, @NonNull String scheduleId) {
// Message finished
}
});isMessageReadyToDisplay will be called whenever state in the app changes (Activity, app state, message finished displaying, etc…), you can also trigger it manually with notifyDisplayConditionsChanged:
InAppAutomation.shared().getInAppMessaging().notifyDisplayConditionsChanged();Next steps
- Learn how to create Scenes in the Airship dashboard
- Present Scene content with Embedded Content
- Create reusable components with Custom Views
- Customize In-App Automation for IAA
Categories