# UiMediaScope

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/MediaQuery.kt+class:androidx.compose.ui.UiMediaScope) Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0) Common/AllAndroid/JVM
- Cmn

  ```
  @ExperimentalMediaQueryApi
  interface UiMediaScope
  ```

*** ** * ** ***

A receiver scope that provides access to the properties of the current media environment. This scope is used by `https://developer.android.com/reference/kotlin/androidx/compose/ui/mediaQuery.composable#mediaQuery(kotlin.Function1)` to evaluate conditions based on the device and window state.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi value class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.FoldOrientation` Describes the hardware orientation of a physical folding hinge. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi value class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.FoldState` Describes the layout fold state of the window, typically on a foldable device. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi value class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.KeyboardKind` Describes the kind of keyboard available. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi value class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.PointerPrecision` Describes the precision of the available pointing devices. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi value class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.ViewingDistance` Describes the typical distance between the user and the screen. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.WindowFold` Represents a single physical fold or hinge intersecting the window. |
| `@https://developer.android.com/reference/kotlin/androidx/compose/ui/ExperimentalMediaQueryApi class https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.WindowPosture` Represents the overall physical posture of the window, aggregating all underlying hardware folding features into a unified state. |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#hasCamera()` Whether the camera is supported on the current device. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#hasMicrophone()` Whether the microphone is supported on the current device. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.KeyboardKind` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#keyboardKind()` The type of keyboard currently available or connected. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.PointerPrecision` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#pointerPrecision()` The highest-precision pointing device currently available. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.ViewingDistance` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#viewingDistance()` The typical distance between the user and the device screen. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#windowHeight()` The current height of the application window. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.WindowPosture` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#windowPosture()` The current posture of the application window. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope#windowWidth()` The current width of the application window. | Cmn |

## Public properties

### hasCamera

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
val hasCamera: Boolean
```

Whether the camera is supported on the current device.

### hasMicrophone

Cmn Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.11.0)

```
val hasMicrophone: Boolean
```

Whether the microphone is supported on the current device.

### keyboardKind

Cmn

```
val keyboardKind: UiMediaScope.KeyboardKind
```

The type of keyboard currently available or connected.

This property prioritizes a physical keyboard connection (`https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.KeyboardKind#Physical()`) over an on-screen soft keyboard (`https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.KeyboardKind#Virtual()`). If neither is detected, it returns `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.KeyboardKind#None()`.

### pointerPrecision

Cmn

```
val pointerPrecision: UiMediaScope.PointerPrecision
```

The highest-precision pointing device currently available.

This property resolves the pointer type based on all connected input devices, prioritizing higher precision (e.g., `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.PointerPrecision#Fine()` takes precedence over `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.PointerPrecision#Coarse()` if both are present). See `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.PointerPrecision` for all possible values.

### viewingDistance

Cmn

```
val viewingDistance: UiMediaScope.ViewingDistance
```

The typical distance between the user and the device screen.

This property provides an estimate of the viewing distance, which can be useful for adjusting UI scale, content density, or hit target sizes for better ergonomics and readability.

Note that this is a broad categorization and does not represent a precise physical measurement. It is based on the device type and its typical usage context.

### windowHeight

Cmn

```
val windowHeight: Dp
```

The current height of the application window.

### windowPosture

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
val windowPosture: UiMediaScope.WindowPosture
```

The current posture of the application window.

This reflects how the window is laid out on the screen, which may be affected by the device's physical state. See `https://developer.android.com/reference/kotlin/androidx/compose/ui/UiMediaScope.WindowPosture` for possible values.

### windowWidth

Cmn

```
val windowWidth: Dp
```

The current width of the application window.