# androidx.xr.compose.platform

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult` | Represents the expected result of a space request. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialCapabilities` | Provides information and functionality related to the spatial capabilities of the application. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialConfiguration` | Provides information and functionality related to the spatial configuration of the application. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Error` | The space transition failed due to a system error or exception. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Success` | The application successfully transitioned to the requested space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Unsupported` | The device or environment does not support XR space transitions. |

## Extension functions summary

|---|---|
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult` | `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity.https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#(androidx.activity.ComponentActivity).requestFullSpace()()` Request that the system place the application into full space. |
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult` | `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity.https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#(androidx.activity.ComponentActivity).requestHomeSpace()()` Request that the system place the application into home space. |

## Top-level properties summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal<https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session?>` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#LocalSession()` A composition local that provides the current Jetpack XR `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal<https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialCapabilities>` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#LocalSpatialCapabilities()` Provides the current `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialCapabilities` that are currently available to the application. |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal<https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialConfiguration>` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#LocalSpatialConfiguration()` Provides the current `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialConfiguration`. |

## Extension functions

### ComponentActivity.requestFullSpace

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/platform/ActivityExt.kt+function:requestFullSpace)

```
suspend fun ComponentActivity.requestFullSpace(): SpaceRequestResult
```

Request that the system place the application into full space.

In full space, this application will be the only application in the visible space, its spatial capabilities will be expanded, and its physical bounds will expand to fill the entire virtual space.

This suspend function initiates an asynchronous OS-level space change and will resume with `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Success` once the application has successfully entered full space. If the device does not support XR spaces, it will resume immediately with `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Unsupported`.

Note: Because full space and home space changes are OS-level system changes, the space switch cannot be aborted mid-flight once initiated. Cancelling this coroutine unregisters the bounds listener but does not interrupt the ongoing space change. If `requestFullSpace` or `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#(androidx.activity.ComponentActivity).requestHomeSpace()` is called again before this request completes, the coroutine suspended on this call will be cancelled with a `CancellationException`.

See [modes in XR](https://developer.android.com/design/ui/xr/guides/foundations#modes).

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Success` if the application successfully enters full space, `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Unsupported` if the device does not support XR spaces, or `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Error` if a system error occurs. |

### ComponentActivity.requestHomeSpace

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/platform/ActivityExt.kt+function:requestHomeSpace)

```
suspend fun ComponentActivity.requestHomeSpace(): SpaceRequestResult
```

Request that the system place the application into home space.

In home space, the visible space may be shared with other applications; however, applications in home space will have their spatial capabilities and physical bounds limited.

This suspend function initiates an asynchronous OS-level space change and will resume with `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Success` once the application has successfully entered home space. If the device does not support XR spaces, it will resume immediately with `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Unsupported`.

Note: Because full space and home space changes are OS-level system changes, the space switch cannot be aborted mid-flight once initiated. Cancelling this coroutine unregisters the bounds listener but does not interrupt the ongoing space change. If `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/package-summary#(androidx.activity.ComponentActivity).requestFullSpace()` or `requestHomeSpace` is called again before this request completes, the coroutine suspended on this call will be cancelled with a `CancellationException`.

See [modes in XR](https://developer.android.com/design/ui/xr/guides/foundations#modes).

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Success` if the application successfully enters home space, `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Unsupported` if the device does not support XR spaces, or `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpaceRequestResult.Error` if a system error occurs. |

## Top-level properties

### LocalSession

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/platform/LocalSession.kt+symbol:LocalSession) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val LocalSession: ProvidableCompositionLocal<Session?>
```

A composition local that provides the current Jetpack XR `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session`.

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

### LocalSpatialCapabilities

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/platform/SpatialCapabilities.kt+symbol:LocalSpatialCapabilities) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val LocalSpatialCapabilities: ProvidableCompositionLocal<SpatialCapabilities>
```

Provides the current `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialCapabilities` that are currently available to the application.

The `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialCapabilities` represents a set of inherent permissions that the application may have depending on the context. For example, in home space mode, the app may not have the ability to create spatial UI; however, in full space mode, the application may have this capability.

### LocalSpatialConfiguration

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/platform/SpatialConfiguration.kt+symbol:LocalSpatialConfiguration) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val LocalSpatialConfiguration: ProvidableCompositionLocal<SpatialConfiguration>
```

Provides the current `https://developer.android.com/reference/kotlin/androidx/xr/compose/platform/SpatialConfiguration`.

The behavior of the configuration object will depend on whether the system XR Spatial feature is enabled.