Launcher

Launcher is the entry point for LauncherKit, providing methods to create ExperienceView and ExperienceFragment instances backed by the given Core configuration.

Obtain an instance via Launcher.default or Launcher.from, then call getExperience or getExperienceFragment to embed a Monterosa experience in your UI.

@Composable
fun ExperienceScreen(core: Core) {
val lifecycleOwner = LocalLifecycleOwner.current

AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
Launcher.from(core).getExperience(
context,
configuration = ExperienceConfiguration(
eventId = "<event-uuid>", // optional, omit for the whole project
hidesHeadersAndFooters = true,
autoresizesHeight = true
)
).apply {
listener = object : ExperienceViewListener {
override fun onReady(experienceView: ExperienceView) { }
override fun onUILoaded(experienceView: ExperienceView) { }
override fun onFailLoading(
experienceView: ExperienceView,
error: MonterosaSdkError
) { }
}

// lets the WebView pause and resume with the host
lifecycleOwner.lifecycle.addObserver(this)
}
},
onRelease = { experience ->
lifecycleOwner.lifecycle.removeObserver(experience)
experience.destroy()
}
)
}

The view owns a WebView and a live bridge, so it must be torn down explicitly. onRelease is the right place in Compose; outside it, call ExperienceView.destroy when the host goes away. Leaving it out keeps the WebView, its threads and its connection alive.

To let the Experience sign the user in, hand it an IdentifyKit from the same Core with experience.identify = IdentifyKit.from(core). For Fragment-based hosting, use getExperienceFragment, which manages the view's lifecycle for you.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override var identifier: String

The unique identifier for this kit instance.

Functions

Link copied to clipboard
open fun close()
Link copied to clipboard
open override fun configure(configurationProvider: ConfigurationProvider)
Link copied to clipboard
fun getExperience(context: Context, configuration: ExperienceConfiguration = ExperienceConfiguration(), customUrl: URL? = null): ExperienceView

Obtain a configured ExperienceView

Link copied to clipboard
fun getExperienceFragment(configuration: ExperienceConfiguration = ExperienceConfiguration(), customUrl: URL? = null): ExperienceFragment

Obtain a configured ExperienceFragment embedding an ExperienceView

Link copied to clipboard
open fun load()