androidx.xr.compose.platform

Interfaces

SessionCallbackProvider

Provides a SessionCallbacks for the current Activity.

SessionCallbacks

Class to store callback lambdas associated with the Session.

SpatialCapabilities

Provides information and functionality related to the spatial capabilities of the application.

SpatialConfiguration

Provides information and functionality related to the spatial configuration of the application.

Classes

SpaceMode

Represents immersion level capabilities of the current application environment.

Objects

Logger

Logger for Subspace Compose.

SceneManager

Manager for all SpatialComposeScenes that are created when the SceneManager is running.

Extension functions summary

Unit
ComponentActivity.setSubspaceContent(
    session: Session?,
    enableXrForTesting: Boolean,
    content: @Composable @SubspaceComposable () -> Unit
)

Composes the provided composable content into this activity's subspace.

Top-level properties summary

ProvidableCompositionLocal<Boolean>

CompositionLocal indicating whether the system XR Spatial feature is enabled.

ProvidableCompositionLocal<Session?>

A composition local that provides the current Jetpack XR Session.

CompositionLocal<SpatialCapabilities>
CompositionLocal<SpatialConfiguration>

Extension functions

setSubspaceContent

fun ComponentActivity.setSubspaceContent(
    session: Session? = null,
    enableXrForTesting: Boolean = false,
    content: @Composable @SubspaceComposable () -> Unit
): Unit

Composes the provided composable content into this activity's subspace.

This method only takes effect in Android XR. Calling it will cause the activity to register itself as a subspace, allowing it to control its own panel (i.e. move and resize within its subspace 3D bounds) and show additional spatial content around it.

Parameters
session: Session? = null

A custom session to be provided for testing purposes. If null, a suitable session for production use will be created.

enableXrForTesting: Boolean = false

When set, this method will assume it is running on Android XR even if it is not. Should only be used for testing, it will cause crashes on non-Android XR devices.

content: @Composable @SubspaceComposable () -> Unit

A @Composable function declaring the spatial UI content.

Top-level properties

LocalHasXrSpatialFeature

val LocalHasXrSpatialFeatureProvidableCompositionLocal<Boolean>

CompositionLocal indicating whether the system XR Spatial feature is enabled.

LocalSession

val LocalSessionProvidableCompositionLocal<Session?>

A composition local that provides the current Jetpack XR Session.

In non-XR environments, this composition local will return null.