---
title: "UiMediaScope"
description: "A receiver scope that provides access to the properties of the current media environment. This
scope is used by [mediaQuery] to evaluate conditions based on the device and window state."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
@ExperimentalMediaQueryApi
interface UiMediaScope
```


A receiver scope that provides access to the properties of the current media environment. This
scope is used by `mediaQuery` to evaluate conditions based on the device and window state.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val windowPosture: Posture
```


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 `Posture` for possible values.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
@get:FrequentlyChangingValue val windowWidth: Dp
```


The current width of the application window.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
@get:FrequentlyChangingValue val windowHeight: Dp
```


The current height of the application window.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val pointerPrecision: 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., `PointerPrecision.Fine` takes precedence over
`PointerPrecision.Coarse` if both are present). See `PointerPrecision` for all possible
values.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val keyboardKind: KeyboardKind
```


The type of keyboard currently available or connected.

This property prioritizes a physical keyboard connection (`AnyKeyboard.Physical`) over an
on-screen soft keyboard (`AnyKeyboard.Virtual`). If neither is detected, it returns
`AnyKeyboard.None`.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val hasMicrophone: Boolean
```


Whether the microphone is supported on the current device.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val hasCamera: Boolean
```


Whether the camera is supported on the current device.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val viewingDistance: 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.




