Screen Helper

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 ScreenHelper 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?

isDeviceSurfaceDuo - Returns if device is SurfaceDuo

  • fun isDeviceSurfaceDuo(context: Context): Boolean

getWindowRect - Returns coordinates of the entire device window

  • fun getWindowRect(context: Context): Rect

getScreenRectangles - Returns a list of two elements that contain the coordinates of the screen rectangles.

  • fun ​getScreenRectangles​(context: Context): List<Rect>?

​isDualMode​ - Returns a boolean that indicates whether 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. (Surface.​ROTATION_0, ​Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270)

  • fun ​getCurrentRotation​(context: Context): Int