@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
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.
@get:FrequentlyChangingValue val windowWidth: Dp
The current width of the application window.
@get:FrequentlyChangingValue val windowHeight: Dp
The current height of the application window.
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.
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.
val hasMicrophone: Boolean
Whether the microphone is supported on the current device.
val hasCamera: Boolean
Whether the camera is supported on the current device.
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.