Screen Info
Important
This article describes functionality and guidance that is in public preview and may be substantially modified before it's generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The ScreenInfo
component lets you get details about the screen state of the device.
getHinge - Returns the coordinates of the Hinge in a Rect object.
fun getHinge(context: Context): Rect?
isSurfaceDuoDevice - Check if the device is Surface Duo.
fun isSurfaceDuoDevice(context: Context): Boolean
getWindowRect - Returns coordinates of the entire device window.
fun getWindowRect(context: Context): Rect
getScreenRectangles - Returns the coordinates of the two screens of the device.
fun getScreenRectangles(context: Context): List<Rect>?
isDualMode - Check if the application is in dual-screen mode or not.
fun isDualMode(context: Context): Boolean
getCurrentRotation - Returns a constant int for the rotation of the screen.
According to the rotation the function will return: Surface.ROTATION_0
, Surface.ROTATION_90
, Surface.ROTATION_180
, Surface.ROTATION_270
.
fun getCurrentRotation(context: Context): Int