SpatialConfiguration

interface SpatialConfiguration


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

Summary

Public companion functions

SpatialConfiguration
getOrCreate(session: Session, hasXrSpatialFeature: Boolean)
Boolean

XR Spatial APIs are supported for this system.

Public functions

open Unit

Request that the system places the application into full space mode.

open Unit

Request that the system places the application into home space mode.

Public properties

open DpVolumeSize

A volume whose width, height, and depth represent the space available to the application.

open Boolean

XR Spatial APIs are supported for this system.

Public companion functions

getOrCreate

Added in 1.0.0-alpha01
fun getOrCreate(session: Session, hasXrSpatialFeature: Boolean): SpatialConfiguration

hasXrSpatialFeature

Added in 1.0.0-alpha01
fun hasXrSpatialFeature(context: Context): Boolean

XR Spatial APIs are supported for this system. This is equivalent to PackageManager.hasSystemFeature(FEATURE_XR_SPATIAL, version) where version is the minimum version for features available in the XR Compose library used.

Public functions

requestFullSpaceMode

Added in 1.0.0-alpha01
open fun requestFullSpaceMode(): Unit

Request that the system places the application into full space mode. This will execute asynchronously. If it completes successfully then bounds will change. This method will throw an UnsupportedOperationException if the application is not in an XR environment.

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.

requestHomeSpaceMode

Added in 1.0.0-alpha01
open fun requestHomeSpaceMode(): Unit

Request that the system places the application into home space mode. This will execute asynchronously. If it completes successfully then bounds will change. This method will throw an UnsupportedOperationException if the application is not in an XR environment.

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.

Public properties

bounds

Added in 1.0.0-alpha01
open val boundsDpVolumeSize

A volume whose width, height, and depth represent the space available to the application.

In XR, an application's available space is not related to the display or window dimensions; instead, it will always be some subset of the virtual 3D space. The app bounds will change when switching between home space or full space modes.

In non-XR environments, the width and height will represent the screen width and height available to the application (see android.content.res.Configuration.screenWidthDp and android.content.res.Configuration.screenHeightDp) and the depth will be zero.

This is a state-based value that will trigger recomposition.

hasXrSpatialFeature

Added in 1.0.0-alpha01
open val hasXrSpatialFeatureBoolean

XR Spatial APIs are supported for this system. This is equivalent to PackageManager.hasSystemFeature(FEATURE_XR_SPATIAL, version) where version is the minimum version for features available in the XR Compose library used.