androidx.xr.scenecore


Interfaces

ActivityPose

Interface for a ActivityPose.

Component

Base interface for all components.

Entity

Interface for a spatial Entity.

Image

Interface for image formats in SceneCore.

InputEventListener

Listener for InputEvents.

JxrPlatformAdapter

Interface for SceneCore Platform operations.

JxrPlatformAdapter.ActivityPanelEntity

Interface for a SceneCore ActivityPanel entity.

JxrPlatformAdapter.ActivityPose

Interface for a SceneCore ActivityPose

JxrPlatformAdapter.ActivitySpace

Interface for a SceneCore activity space.

JxrPlatformAdapter.ActivitySpace.OnBoundsChangedListener

Interface for a listener which receives changes to the bounds of the primary Activity.

JxrPlatformAdapter.AnchorEntity

Interface for Anchor entity.

JxrPlatformAdapter.AnchorEntity.OnStateChangedListener

Interface for listening to Anchor state changes.

JxrPlatformAdapter.AnchorEntity.PersistStateChangeListener

Interface for listening to Anchor persist state changes.

JxrPlatformAdapter.AnchorPlacement

Interface for an AnchorPlacement.

JxrPlatformAdapter.AudioTrackExtensionsWrapper

Interface for a SceneCore AudioTrackExtensionsWrapper

JxrPlatformAdapter.CameraViewActivityPose

Interface for a SceneCore camera view ActivityPose.

JxrPlatformAdapter.Component

Base interface for all components.

JxrPlatformAdapter.Entity

Interface for a SceneCore Entity

JxrPlatformAdapter.ExrImageResource

Interface for an EXR resource.

JxrPlatformAdapter.GltfEntity

Interface for a SceneCore [GltfEntity].

JxrPlatformAdapter.GltfModelResource

Interface for a glTF resource.

JxrPlatformAdapter.HeadActivityPose

Interface for a SceneCore head ActivityPose.

JxrPlatformAdapter.InputEventListener

Interface for Input listener.

JxrPlatformAdapter.InteractableComponent

Component to enable input interactions.

JxrPlatformAdapter.LoggingEntity

Interface for a SceneCore Entity that only logs the pose.

JxrPlatformAdapter.MediaPlayerExtensionsWrapper

Interface for a SceneCore MediaPlayerExtensionsWrapper

JxrPlatformAdapter.MovableComponent

Component to enable a high level user movement affordance.

JxrPlatformAdapter.MoveEventListener

Interface for MoveEvent listener.

JxrPlatformAdapter.PanelEntity

Interface for a SceneCore Panel entity

JxrPlatformAdapter.PerceptionSpaceActivityPose

Interface for the perception space ActivityPose.

JxrPlatformAdapter.PointerCaptureComponent

Component to enable pointer capture.

JxrPlatformAdapter.PointerCaptureComponent.StateListener

Functional interface for receiving updates about the state of pointer capture.

JxrPlatformAdapter.ResizableComponent

Component to enable resize semantics.

JxrPlatformAdapter.ResizeEventListener

Interface for ResizeEvent listener.

JxrPlatformAdapter.Resource

Interface for a SceneCore resource.

JxrPlatformAdapter.SoundPoolExtensionsWrapper

Interface for a SceneCore SoundPoolExtensionsWrapper.

JxrPlatformAdapter.SpatialEnvironment

Interface for updating the background image/geometry and passthrough settings.

JxrPlatformAdapter.StereoSurfaceEntity

Interface for a surface which images can be rendered into.

JxrPlatformAdapter.StereoSurfaceEntity.CanvasShape

Represents the shape of the spatial canvas which the surface is texture mapped to.

JxrPlatformAdapter.SystemSpaceEntity

Interface for a system-controlled SceneCore Entity that defines its own coordinate space.

JxrPlatformAdapter.SystemSpaceEntity.OnSpaceUpdatedListener

Interface for a listener which receives changes to the underlying space.

Model

Represents a 3D model in SceneCore.

MoveListener

Listener for move actions.

OnBoundsChangeListener

This interface is deprecated. Use addBoundsChangedListener(Consumer<Dimensions>)

OnSpaceUpdatedListener
OnStateChangedListener
PointerCaptureComponent.StateListener

Listener for pointer capture state changes.

ResizeListener

Listener for resize actions.

SpatializerConstants

Constants for spatialized audio.

Classes

ActivityPanelEntity

ActivityPanelEntity creates a spatial panel for embedding an Activity in Android XR.

ActivitySpace

ActivitySpace is an Entity used to track the system-managed pose and boundary of the volume associated with this Spatialized Activity.

AnchorEntity

An AnchorEntity is created to track a Pose relative to some position or surface in the "Real World." Children of this Entity will remain positioned relative to that location in the real world, for the purposes of creating Augmented Reality experiences.

AnchorPlacement

Creates an AnchorPlacement for a MovableComponent.

BaseActivityPose

The BaseActivityPose is an implementation of ActivityPose interface that wraps a platformAdapter ActivityPose.

BaseEntity

The BaseEntity is an implementation of Entity interface that wraps a platform entity.

BasePanelEntity

Provides implementations for common Panel functionality.

CameraView

A ActivityPose which tracks a camera's position and view into physical space.

ContentlessEntity

An Entity that itself has no content.

Dimensions

Dimensions of a 3D object.

ExrImage

ExrImage represents an EXR Image resource in SceneCore.

Fov

The angles (in radians) representing the sides of the view frustum.

GltfModel

GltfModel represents a glTF resource in SceneCore.

GltfModelEntity

GltfModelEntity is a concrete implementation of Entity that hosts a glTF model.

Head

Head is a ActivityPose used to track the position of the user's head.

InputEvent

Defines input events for XRCore.

InputEvent.HitInfo

Information about the hit result of the ray.

InteractableComponent

Provides access to raw input events for given Entity, so a client can implement their own interaction logic.

JxrPlatformAdapter.CameraViewActivityPose.Fov

The angles (in radians) representing the sides of the view frustum.

JxrPlatformAdapter.Dimensions

The dimensions of a UI element in meters.

JxrPlatformAdapter.InputEvent

InputEvent for SceneCore Platform.

JxrPlatformAdapter.InputEvent.HitInfo

Info about the hit result of the ray.

JxrPlatformAdapter.MoveEvent

MoveEvent for SceneCore Platform.

JxrPlatformAdapter.PixelDimensions

The dimensions of a UI element in pixels.

JxrPlatformAdapter.PointSourceAttributes

Represents a SceneCore PointSourceAttributes

JxrPlatformAdapter.Ray

Ray in 3D Cartesian space.

JxrPlatformAdapter.ResizeEvent

ResizeEvent for SceneCore Platform.

JxrPlatformAdapter.SoundFieldAttributes

Represents a SceneCore SoundFieldAttributes

JxrPlatformAdapter.SpatialCapabilities

Spatial Capabilities for SceneCore Platform.

JxrPlatformAdapter.SpatialEnvironment.SpatialEnvironmentPreference

A class that represents the user's preferred spatial environment.

JxrPlatformAdapter.SpatializerConstants

Contains the constants used to spatialize audio in SceneCore.

JxrPlatformAdapter.StereoSurfaceEntity.CanvasShape.Quad

A 2D rectangle-shaped canvas.

JxrPlatformAdapter.StereoSurfaceEntity.CanvasShape.Vr180Hemisphere

A hemisphere-shaped canvas.

JxrPlatformAdapter.StereoSurfaceEntity.CanvasShape.Vr360Sphere

A sphere-shaped canvas.

MovableComponent

Allows users to interactively move the Entity.

PanelEntity

PanelEntity creates a spatial panel in Android XR.

PerceptionSpace

PerceptionSpace is ActivityPose used to track the origin of the space used by ARCore for XR APIs.

PixelDimensions

Dimensions of a 2D surface in Pixels.

PointSourceAttributes

PointSourceAttributes is used to configure a sound be spatialized as a 3D point.

PointerCaptureComponent

Provides pointer capture capabilities for a given entity.

ResizableComponent

A Component which when attached to a PanelEntity provides a user-resize affordance.

Session

The Session provides the primary interface to SceneCore functionality for the application.

SoundFieldAttributes

Configures ambisonics sound sources.

SpatialAudioTrack
SpatialAudioTrackBuilder

Provides spatial audio extensions on the platform AudioTrack.Builder class.

SpatialCapabilities

Representation of the spatial capabilities of the current session.

SpatialEnvironment

The SpatialEnvironment is used to manage the XR background and passthrough.

SpatialEnvironment.PassthroughMode

This class is deprecated. Use isSpatialEnvironmentPreferenceActive() instead.

SpatialEnvironment.SetPassthroughOpacityPreferenceChangeApplied

The call to setPassthroughOpacityPreference succeeded and should now be visible.

SpatialEnvironment.SetPassthroughOpacityPreferenceChangePending

The call to setPassthroughOpacityPreference successfully applied the preference, but it is not immediately visible due to requesting a state change while the activity does not have the SpatialCapabilities.SPATIAL_CAPABILITY_PASSTHROUGH_CONTROL capability to control the app passthrough state.

SpatialEnvironment.SetPassthroughOpacityPreferenceResult

Result values for calls to setPassthroughOpacityPreference

SpatialEnvironment.SetSpatialEnvironmentPreferenceChangeApplied

The call to setSpatialEnvironmentPreference succeeded and should now be visible.

SpatialEnvironment.SetSpatialEnvironmentPreferenceChangePending

The call to setSpatialEnvironmentPreference successfully applied the preference, but it is not immediately visible due to requesting a state change while the activity does not have the SpatialCapabilities.SPATIAL_CAPABILITY_APP_ENVIRONMENTS capability to control the app environment state.

SpatialEnvironment.SetSpatialEnvironmentPreferenceResult

Result values for calls to SpatialEnvironment.setSpatialEnvironmentPreference

SpatialEnvironment.SpatialEnvironmentPreference

Represents the preferred spatial environment for the application.

SpatialMediaPlayer
SpatialSoundPool

Provides spatial audio extensions on the framework SoundPool class.

SpatialUser

The User object is used to retrieve information about the user.

StereoSurfaceEntity

StereoSurfaceEntity is a concrete implementation of Entity that hosts a StereoSurface Canvas.

StereoSurfaceEntity.CanvasShape

Represents the shape of the StereoSurface Canvas that backs a StereoSurfaceEntity.

StereoSurfaceEntity.CanvasShape.Quad
StereoSurfaceEntity.CanvasShape.Vr180Hemisphere
StereoSurfaceEntity.CanvasShape.Vr360Sphere

Objects

AnchorEntity.State
GltfModelEntity.AnimationState
PermissionHelper

Utility class for handling Android permissions.

PlaneSemantic

Semantic plane types.

PlaneType

Type of plane based on orientation i.e. Horizontal or Vertical.

StereoSurfaceEntity.StereoMode

Enums

AnchorEntity.PersistState

Specifies the current persist state of the Anchor.

CameraView.CameraType

Describes the type of camera that this CameraView represents.

JxrPlatformAdapter.AnchorEntity.PersistState

Specifies the current persistence state of the Anchor.

JxrPlatformAdapter.AnchorEntity.State

Specifies the current tracking state of the Anchor.

JxrPlatformAdapter.PlaneSemantic

Semantic plane types.

JxrPlatformAdapter.PlaneType

Type of plane based on orientation i.e. Horizontal or Vertical.

JxrPlatformAdapter.SpatialEnvironment.SetPassthroughOpacityPreferenceResult

Result values for calls to SpatialEnvironment.setPassthroughOpacityPreference

JxrPlatformAdapter.SpatialEnvironment.SetSpatialEnvironmentPreferenceResult

Result values for calls to SpatialEnvironment.setSpatialEnvironmentPreference

Extension functions summary

Unit

Adds the given Consumer as a listener to be invoked when this Session's current SpatialCapabilities change.

Unit

Adds the given Consumer as a listener to be invoked when this Session's current SpatialCapabilities change.

List<T>

Returns all Entitys of the given type or its subtypes.

SpatialCapabilities

Returns the current SpatialCapabilities of the Session.

Unit

Releases the given Consumer from receiving updates when the Session's SpatialCapabilities change.

Bundle

Sets the full space mode flag to the given android.os.Bundle.

Bundle

Sets the inherit full space mode environvment flag to the given android.os.Bundle.

Unit
Session.setPreferredAspectRatio(
    activity: Activity,
    preferredRatio: Float
)

Sets a preferred main panel aspect ratio for home space mode.

Extension functions

addSpatialCapabilitiesChangedListener

fun Session.addSpatialCapabilitiesChangedListener(
    listener: Consumer<SpatialCapabilities>
): Unit

Adds the given Consumer as a listener to be invoked when this Session's current SpatialCapabilities change. Consumer#accept(SpatialCapabilities) will be invoked on the main thread.

addSpatialCapabilitiesChangedListener

fun Session.addSpatialCapabilitiesChangedListener(
    callbackExecutor: Executor,
    listener: Consumer<SpatialCapabilities>
): Unit

Adds the given Consumer as a listener to be invoked when this Session's current SpatialCapabilities change. Consumer#accept(SpatialCapabilities) will be invoked on the given callbackExecutor, or the main thread if the callbackExecutor is null (default).

getEntitiesOfType

fun <T : Entity> Session.getEntitiesOfType(type: Class<T>): List<T>

Returns all Entitys of the given type or its subtypes.

Parameters
type: Class<T>

the type of Entity to return.

Returns
List<T>

a list of all Entitys of the given type.

getSpatialCapabilities

fun Session.getSpatialCapabilities(): SpatialCapabilities

Returns the current SpatialCapabilities of the Session. The set of capabilities can change within a session. The returned object will not update if the capabilities change; this method should be called again to get the latest set of capabilities.

removeSpatialCapabilitiesChangedListener

fun Session.removeSpatialCapabilitiesChangedListener(
    listener: Consumer<SpatialCapabilities>
): Unit

Releases the given Consumer from receiving updates when the Session's SpatialCapabilities change.

setFullSpaceMode

fun Session.setFullSpaceMode(bundle: Bundle): Bundle

Sets the full space mode flag to the given android.os.Bundle.

The android.os.Bundle then could be used to launch an android.app.Activity with requesting to enter full space mode through android.app.Activity.startActivity. If there's a bundle used for customizing how the android.app.Activity should be started by android.app.ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle, it's suggested to use the bundle to call this method.

The flag will be ignored when no android.content.Intent.FLAG_ACTIVITY_NEW_TASK is set in the bundle, or it is not started from a focused Activity context.

This flag is also ignored when the android.window.PROPERTY_XR_ACTIVITY_START_MODE property is set to a value other than XR_ACTIVITY_START_MODE_UNDEFINED in the AndroidManifest.xml file for the activity being launched.

Parameters
bundle: Bundle

the input bundle to set with the full space mode flag.

Returns
Bundle

the input bundle with the full space mode flag set.

setFullSpaceModeWithEnvironmentInherited

fun Session.setFullSpaceModeWithEnvironmentInherited(bundle: Bundle): Bundle

Sets the inherit full space mode environvment flag to the given android.os.Bundle.

The android.os.Bundle then could be used to launch an android.app.Activity with requesting to enter full space mode while inherit the existing environment through android.app.Activity.startActivity. If there's a bundle used for customizing how the android.app.Activity should be started by android.app.ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle, it's suggested to use the bundle to call this method.

When launched, the activity will be in full space mode and also inherits the environment from the launching activity. If the inherited environment needs to be animated, the launching activity has to continue updating the environment even after the activity is put into the stopped state.

The flag will be ignored when no android.content.Intent.FLAG_ACTIVITY_NEW_TASK is set in the intent, or it is not started from a focused Activity context.

The flag will also be ignored when there is no environment to inherit or the activity has its own environment set already.

This flag is ignored too when the android.window.PROPERTY_XR_ACTIVITY_START_MODE property is set to a value other than XR_ACTIVITY_START_MODE_UNDEFINED in the AndroidManifest.xml file for the activity being launched.

For security reasons, Z testing for the new activity is disabled, and the activity is always drawn on top of the inherited environment. Because Z testing is disabled, the activity should not spatialize itself.

Parameters
bundle: Bundle

the input bundle to set with the inherit full space mode environment flag.

Returns
Bundle

the input bundle with the inherit full space mode flag set.

setPreferredAspectRatio

fun Session.setPreferredAspectRatio(
    activity: Activity,
    preferredRatio: Float
): Unit

Sets a preferred main panel aspect ratio for home space mode.

The ratio is only applied to the activity. If the activity launches another activity in the same task, the ratio is not applied to the new activity. Also, while the activity is in full space mode, the preference is temporarily removed.

If the activity's current aspect ratio differs from the preferredRatio, the panel is automatically resized. This resizing preserves the panel's area. To avoid runtime resizing, consider specifying the desired aspect ratio in your AndroidManifest.xml. This ensures your activity launches with the preferred aspect ratio from the start.

Parameters
activity: Activity

the activity to set the preference.

preferredRatio: Float

the aspect ratio determined by taking the panel's width over its height. A value <= 0.0f means there are no preferences.