Skip to main content

Present onboardings in Android SDK

Before you start, ensure that:

  1. You have installed Adapty Android SDK 3.8.0 or later.
  2. You have created an onboarding.
  3. You have added the onboarding to a placement.

If you've customized an onboarding using the Onboarding Builder, you don't need to worry about rendering it in your mobile app code to display it to the user. Such an onboarding contains both what should be shown and how it should be shown.

In order to display the visual onboarding on the device screen, you must first configure it. To do this, call the method AdaptyUI.getOnboardingView() or create the OnboardingView directly:

val onboardingView = AdaptyUI.getOnboardingView(
activity = this,
viewConfig = onboardingConfig,
eventListener = eventListener
)

After the view has been successfully created, you can add it to the view hierarchy and display it on the device screen.

Request parameters:

ParameterPresenceDescription
viewConfigrequiredThe onboarding configuration obtained from AdaptyUI.getOnboardingConfiguration()
eventListenerrequiredAn implementation of AdaptyOnboardingEventListener to handle onboarding events. Refer to Handling onboarding events for more details.

Change loading indicator color

You can override the default color of the loading indicator in the following way:

<!--your theme -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<!--other attrs -->
<item name="adapty_progressIndicatorColor">@color/yourColor</item>
</style>

Add smooth transitions between the splash screen and onboarding

By default, between the splash screen and onboarding, you will see the loading screen until the onboarding is fully loaded. However, if you want to make the transition smoother, you can customize it and either extend the splash screen or display something else.

To do this, create adapty_onboarding_placeholder_view.xml in res/layout and define a placeholder (what exactly will be shown while the onboarding is being loaded) there.

If you define a placeholder, the onboarding will be loaded in the background and automatically displayed once ready.

Disable safe area paddings

By default, the onboarding view automatically applies safe area paddings to avoid system UI elements like status bar and navigation bar. However, if you want to disable this behavior and have full control over the layout, you can do so by setting the safeAreaPaddings parameter to false.

val onboardingView = AdaptyUI.getOnboardingView(
activity = this,
viewConfig = onboardingConfig,
eventListener = eventListener,
safeAreaPaddings = false
)

Alternatively, you can control this behavior globally by adding a boolean resource to your app:

<!-- res/values/bools.xml -->
<resources>
<bool name="adapty_onboarding_enable_safe_area_paddings">false</bool>
</resources>

When safeAreaPaddings is set to false, the onboarding will extend to the full screen without any automatic padding adjustments, giving you complete control over the layout and allowing the onboarding content to use the entire screen space.