Skip to main content

Integrate with Android

Before you start: document delivery.

Android separates the platform-free core, View renderer, Compose host, and convenience entry point. Use JDK 17, JVM target 11, minSdk 24, and compileSdk 36.

ModuleResponsibility
relo-corePlatform-free facade over shared semantics
relo-viewsAndroid View rendering and native adapters
relo-composeCompose module scaffold. Use Compose’s AndroidView to host the View renderer.
relo-uiView convenience runtime
relo-ui-componentsOptional host support for Components adapters and services

Create a session​

import com.relo_ui.ReloUI
import com.relo_ui.core.RemoteDocument

val runtime = ReloUI()
val document = RemoteDocument("<Text text=\"Hello, native UI\" />")
val session = runtime.session(document)

If your document uses the library’s host adapters or services, call ReloUIComponents.install(runtime) from com.relo_ui.components before session creation. Mount a RemoteView with the appropriate Android lifecycle owner. In a Fragment, the example host uses viewLifecycleOwner for the attachment and retains the logical session in its ViewModel.

Register services and manage lifetime​

Register typed actions and native components before session creation. The app owns transport, navigation, authentication, and durable state. Release the View attachment with the Fragment's view lifecycle; close the session when its destination is permanently removed.

The Android application guide points to working host implementations, including typed actions, shared bindings, list updates, and back-stack retention. Use the setup guide and scripts/android for supported builds.

Compose hosts the same View renderer; it doesn't introduce another document renderer.