With the default implementation, the Experience will load when it is shown to the user, but if you are aiming to reduce the loading time, you can trigger proactive loading so that itβs ready to go when the user wants to see it.
Note: This feature is not yet available in the Javascript SDK.
Use the following snippet:
let experience = Launcher.getExperience()
// At this point the experience will already be loading in the background
// You could now store it in memory until you need to embed it in your UI.
// Please note that this may consume resources, so be careful about how many
// Experiences you preload.
// Eventually...
<yourView>.addSubview(experience)
// You need to ensure the experiences are laid out however you see fit.
// For instance, could use autolayout constraints, or setting
// their frame
// Assumes `this` is an activity, otherwise update this line
// to locate the context you want to use.
val context = this
val config = ExperienceConfiguration()
val experienceView = Launcher.default.getExperience(context, config)
// At this point the experience will already be loading in the background
// You could now store it in memory until you need to embed it in your UI.
// Please note that this may consume resources, so be careful about how many
// Experiences you preload.
// Eventually...
rootContainer.addView(experience)