Transition from Home Space to Full Space

A user can experience your app in two modes, Home Space or Full Space. In Home Space, a user is able to multitask with your app running side by side with other apps. In Full Space, your app takes center stage as the focus of the user's experience with full access to the immersive capabilities of Android XR.

Your app opens in Home Space by default unless you specify otherwise as described in the Declare the default mode for launch section.

Spatialization is only supported in Full Space. Your app can transition to Full Space to take advantage of spatial and 3D capabilities. When your app has focus, you can transition between these modes by requesting the corresponding space.

Transition between Home Space and Full Space

If you are using the Jetpack Compose for XR library, request home space or full space using the LocalSpatialConfiguration composition local.

LocalSpatialConfiguration.current.requestHomeSpaceMode()
// or
LocalSpatialConfiguration.current.requestFullSpaceMode()

If you are using the Jetpack SceneCore library you can request the corresponding space from the Session.

val xrSession = Session.create(this)
xrSession.spatialEnvironment.requestHomeSpaceMode()

See the Learn Android XR Fundamentals: Part 1 - Modes and Spatial Panels codelab for examples of how to use these requests to transition between modes by clicking a button. We also recommend reviewing our design guidance to learn more about Home space to Full space and how to best transition between the two.

Declare the default mode for launch

Alternatively, you can add the following lines to your Android Manifest file to choose which space your app should open in:

<!-- Launch in Full Space. -->
<property
   android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
   android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_MANAGED" />

<!-- Or, launch in Home Space. -->
<property
   android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
   android:value="XR_ACTIVITY_START_MODE_HOME_SPACE_MANAGED" />

See also