class XrDevice


Provides hardware capabilities of the device.

Summary

Nested types

This class is deprecated. Use androidx.xr.runtime.DisplayBlendMode instead.

Public companion functions

XrDevice

Get the current XrDevice for the provided Session.

XrDevice
@ExperimentalXrDeviceLifecycleApi
getCurrentDevice(
    context: Context,
    session: Session,
    coroutineContext: CoroutineContext
)

Get the current XrDevice for the provided Context.

Public functions

Lifecycle

Returns this XrDevice's Lifecycle.

DisplayBlendMode

Returns the preferred display blend mode for this session.

Public companion functions

getCurrentDevice

Added in 1.0.0-alpha11
fun getCurrentDevice(session: Session): XrDevice

Get the current XrDevice for the provided Session.

Parameters
session: Session

the Session connected to the device.

getCurrentDevice

Added in 1.0.0-alpha11
@ExperimentalXrDeviceLifecycleApi
fun getCurrentDevice(
    context: Context,
    session: Session,
    coroutineContext: CoroutineContext = EmptyCoroutineContext
): XrDevice

Get the current XrDevice for the provided Context.

Parameters
context: Context

the Context associated with the device

session: Session

the Session connected to the device

coroutineContext: CoroutineContext = EmptyCoroutineContext

the CoroutineContext to use for the XrDevice operations

Throws
IllegalArgumentException

if the provided Context is not supported

Public functions

getLifecycle

Added in 1.0.0-alpha11
@ExperimentalXrDeviceLifecycleApi
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.

getPreferredDisplayBlendMode

Added in 1.0.0-alpha11
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.

Throws
IllegalStateException

if the Session has been destroyed.