class XrDevice


Provides hardware capabilities of the device.

Summary

Public companion functions

XrDevice
getCurrentDevice(context: Context, coroutineContext: CoroutineContext)

Get the current XrDevice for the provided Context.

Boolean

Returns true if the Android XR Projected service is available on this device.

Public functions

Lifecycle

Returns this XrDevice's Lifecycle.

DisplayBlendMode

Returns the preferred display blend mode for this session.

Boolean

Returns the XrDevice's support for the given DepthEstimationMode.

Boolean

Returns the XrDevice's support for the given EyeTrackingMode.

Boolean

Returns the XrDevice's support for the given GeospatialMode.

Boolean

Returns the XrDevice's support for the given HandTrackingMode.

Boolean

Returns whether the XrDevice supports the supplied RenderingMode.

Public companion functions

getCurrentDevice

Added in 1.0.0-alpha15
fun getCurrentDevice(
    context: Context,
    coroutineContext: CoroutineContext = EmptyCoroutineContext
): XrDevice

Get the current XrDevice for the provided Context.

Parameters
context: Context

the Context associated with the device

coroutineContext: CoroutineContext = EmptyCoroutineContext

the CoroutineContext to use for the XrDevice operations

Throws
IllegalArgumentException

if the provided Context is not supported

isProjectedServiceAvailable

Added in 1.0.0-alpha15
fun isProjectedServiceAvailable(context: Context): Boolean

Returns true if the Android XR Projected service is available on this device. This means the device supports the necessary system features and has the required system service components for Projected experiences. Returns false otherwise.

Public functions

getLifecycle

Added in 1.0.0-alpha15
fun getLifecycle(): Lifecycle

Returns this XrDevice's Lifecycle.

The value will be the Projected device's lifecycle if its Context was used when calling getCurrentDevice. Otherwise, the Session's lifecycle will be returned.

Throws
IllegalStateException

if there is no lifecycle associated with this XrDevice.

getPreferredDisplayBlendMode

Added in 1.0.0-alpha15
fun getPreferredDisplayBlendMode(): DisplayBlendMode

Returns the preferred display blend mode for this session.

Returns
DisplayBlendMode

The DisplayBlendMode that is preferred by the Session for rendering. DisplayBlendMode.NO_DISPLAY will be returned if there are no supported blend modes available.

isDepthEstimationModeSupported

Added in 1.0.0-alpha15
fun isDepthEstimationModeSupported(mode: DepthEstimationMode): Boolean

Returns the XrDevice's support for the given DepthEstimationMode.

Returns
Boolean

whether the device supports the supplied DepthEstimationMode.

isEyeTrackingModeSupported

Added in 1.0.0-alpha15
fun isEyeTrackingModeSupported(mode: EyeTrackingMode): Boolean

Returns the XrDevice's support for the given EyeTrackingMode.

Returns
Boolean

whether the device supports the supplied EyeTrackingMode.

isGeospatialModeSupported

Added in 1.0.0-alpha15
fun isGeospatialModeSupported(mode: GeospatialMode): Boolean

Returns the XrDevice's support for the given GeospatialMode.

Returns
Boolean

whether the device supports the supplied GeospatialMode.

isHandTrackingModeSupported

Added in 1.0.0-alpha15
fun isHandTrackingModeSupported(mode: HandTrackingMode): Boolean

Returns the XrDevice's support for the given HandTrackingMode.

Returns
Boolean

whether the device supports the supplied HandTrackingMode.

isRenderingModeSupported

Added in 1.0.0-alpha15
fun isRenderingModeSupported(mode: RenderingMode): Boolean

Returns whether the XrDevice supports the supplied RenderingMode.

Returns
Boolean

whether the device supports the supplied RenderingMode. For devices that support RenderingMode.MONO, RenderViewpoint.mono(session) is expected to be non-null. For devices that support RenderingMode.STEREO, RenderViewpoint.left(session), RenderViewpoint.right(session), and RenderViewpoint.mono(session) are all expected to be non-null.