# 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)

*** ** * ** ***


```
public final class XrDevice
```

<br />

*** ** * ** ***

Device hardware capabilities.

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/XrDevice` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#getCurrentDevice(android.content.Context,kotlin.coroutines.CoroutineContext)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html coroutineContext )` Get the current `https://developer.android.com/reference/androidx/xr/runtime/XrDevice` for the provided `https://developer.android.com/reference/android/content/Context.html`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#getLifecycle()()` Returns this XrDevice's `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/DisplayBlendMode` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#getPreferredDisplayBlendMode()()` Returns the preferred display blend mode for this session. |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isDepthEstimationModeSupported(androidx.xr.runtime.DepthEstimationMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/DepthEstimationMode mode)` Returns the `https://developer.android.com/reference/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/androidx/xr/runtime/DepthEstimationMode`. |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isEyeTrackingModeSupported(androidx.xr.runtime.EyeTrackingMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/EyeTrackingMode mode)` Returns the `https://developer.android.com/reference/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/androidx/xr/runtime/EyeTrackingMode`. |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isGeospatialModeSupported(androidx.xr.runtime.GeospatialMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/GeospatialMode mode)` Returns the `https://developer.android.com/reference/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/androidx/xr/runtime/GeospatialMode`. |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isHandTrackingModeSupported(androidx.xr.runtime.HandTrackingMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/HandTrackingMode mode)` Returns the `https://developer.android.com/reference/androidx/xr/runtime/XrDevice`'s support for the given `https://developer.android.com/reference/androidx/xr/runtime/HandTrackingMode`. |
| `static final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isProjectedServiceAvailable(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Returns true if the Android XR Projected service is available on this device. |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/runtime/XrDevice#isRenderingModeSupported(androidx.xr.runtime.RenderingMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/RenderingMode mode)` Returns whether the `https://developer.android.com/reference/androidx/xr/runtime/XrDevice` supports the supplied `https://developer.android.com/reference/androidx/xr/runtime/RenderingMode`. |

## Public methods

### getCurrentDevice

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

```
public static final @NonNull XrDevice getCurrentDevice(
    @NonNull Context context,
    @NonNull CoroutineContext coroutineContext
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | the `https://developer.android.com/reference/android/content/Context.html` associated with the device |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html coroutineContext` | 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 |

### getLifecycle

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

```
public final @NonNull Lifecycle getLifecycle()
```

Returns this XrDevice's `https://developer.android.com/reference/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/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)

```
public final @NonNull DisplayBlendMode getPreferredDisplayBlendMode()
```

Returns the preferred display blend mode for this session.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/DisplayBlendMode` | the `https://developer.android.com/reference/androidx/xr/runtime/DisplayBlendMode` that is preferred by the `https://developer.android.com/reference/androidx/xr/runtime/Session` for rendering `https://developer.android.com/reference/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)

```
public final boolean isDepthEstimationModeSupported(@NonNull DepthEstimationMode mode)
```

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

| Returns |
|---|---|
| `boolean` | whether the device supports the supplied `https://developer.android.com/reference/androidx/xr/runtime/DepthEstimationMode` |

### isEyeTrackingModeSupported

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

```
public final boolean isEyeTrackingModeSupported(@NonNull EyeTrackingMode mode)
```

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

| Returns |
|---|---|
| `boolean` | whether the device supports the supplied `https://developer.android.com/reference/androidx/xr/runtime/EyeTrackingMode` |

### isGeospatialModeSupported

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

```
public final boolean isGeospatialModeSupported(@NonNull GeospatialMode mode)
```

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

| Returns |
|---|---|
| `boolean` | whether the device supports the supplied `https://developer.android.com/reference/androidx/xr/runtime/GeospatialMode` |

### isHandTrackingModeSupported

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

```
public final boolean isHandTrackingModeSupported(@NonNull HandTrackingMode mode)
```

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

| Returns |
|---|---|
| `boolean` | whether the device supports the supplied `https://developer.android.com/reference/androidx/xr/runtime/HandTrackingMode` |

### isProjectedServiceAvailable

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

```
public static final boolean isProjectedServiceAvailable(@NonNull Context context)
```

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.

### isRenderingModeSupported

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

```
public final boolean isRenderingModeSupported(@NonNull RenderingMode mode)
```

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

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