# XrDevice

Artifact: [androidx.xr.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/xr-runtime) [View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/XrDevice.kt+class:androidx.xr.runtime.XrDevice) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

*** ** * ** ***


```
class XrDevice
```

<br />

*** ** * ** ***

Device hardware capabilities.

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#getCurrentDevice(android.content.Context,kotlin.coroutines.CoroutineContext)(context: https://developer.android.com/reference/android/content/Context.html, coroutineContext: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html)` Get the current `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice` for the provided `https://developer.android.com/reference/android/content/Context.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isProjectedServiceAvailable(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Returns true if the Android XR Projected service is available on this device. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#getLifecycle()()` Returns this XrDevice's `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DisplayBlendMode` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#getPreferredDisplayBlendMode()()` Returns the preferred display blend mode for this session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isDepthEstimationModeSupported(androidx.xr.runtime.DepthEstimationMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode)` Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isEyeTrackingModeSupported(androidx.xr.runtime.EyeTrackingMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/runtime/EyeTrackingMode)` Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/EyeTrackingMode`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isGeospatialModeSupported(androidx.xr.runtime.GeospatialMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/runtime/GeospatialMode)` Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/GeospatialMode`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isHandTrackingModeSupported(androidx.xr.runtime.HandTrackingMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/runtime/HandTrackingMode)` Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/HandTrackingMode`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#isRenderingModeSupported(androidx.xr.runtime.RenderingMode)(mode: https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode)` Returns whether the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice` supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode`. |

## Public companion functions

### getCurrentDevice

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun getCurrentDevice(
    context: Context,
    coroutineContext: CoroutineContext = EmptyCoroutineContext
): XrDevice
```

Get the current `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice` for the provided `https://developer.android.com/reference/android/content/Context.html`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the `https://developer.android.com/reference/android/content/Context.html` associated with the device |
| `coroutineContext: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html = EmptyCoroutineContext` | the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` to use for the XrDevice operations |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the provided `https://developer.android.com/reference/android/content/Context.html` is not supported |

### isProjectedServiceAvailable

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
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](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun getLifecycle(): Lifecycle
```

Returns this XrDevice's `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle`.

The value will be the Projected device's lifecycle if its `https://developer.android.com/reference/android/content/Context.html` was used when calling `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice#getCurrentDevice(android.content.Context,kotlin.coroutines.CoroutineContext)`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if there is no lifecycle associated with this XrDevice |

### getPreferredDisplayBlendMode

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun getPreferredDisplayBlendMode(): DisplayBlendMode
```

Returns the preferred display blend mode for this session.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DisplayBlendMode` | the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DisplayBlendMode` that is preferred by the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` for rendering `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DisplayBlendMode#NO_DISPLAY()` will be returned if there are no supported blend modes available |

### isDepthEstimationModeSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun isDepthEstimationModeSupported(mode: DepthEstimationMode): Boolean
```

Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the device supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/DepthEstimationMode` |

### isEyeTrackingModeSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun isEyeTrackingModeSupported(mode: EyeTrackingMode): Boolean
```

Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/EyeTrackingMode`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the device supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/EyeTrackingMode` |

### isGeospatialModeSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun isGeospatialModeSupported(mode: GeospatialMode): Boolean
```

Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/GeospatialMode`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the device supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/GeospatialMode` |

### isHandTrackingModeSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun isHandTrackingModeSupported(mode: HandTrackingMode): Boolean
```

Returns the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/kotlin/androidx/xr/runtime/HandTrackingMode`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the device supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/HandTrackingMode` |

### isRenderingModeSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
fun isRenderingModeSupported(mode: RenderingMode): Boolean
```

Returns whether the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/XrDevice` supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the device supports the supplied `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode`. For devices that support `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode#MONO()`, RenderViewpoint.mono(session) is expected to be non-null. For devices that support `https://developer.android.com/reference/kotlin/androidx/xr/runtime/RenderingMode#STEREO()`, RenderViewpoint.left(session), RenderViewpoint.right(session), and RenderViewpoint.mono(session) are all expected to be non-null |