Access dual-screen info on Surface Duo from Unity

The Microsoft dual-screen SDK is available as a package that can be included in your Unity project by customizing the gradle build system, and then adding a C# helper class that calls the native Java API.

Microsoft dual-screen SDK for Surface Duo

The SurfaceDuoScreenHelper.cs code provides these methods that expose information supplied by the Microsoft SDK for Surface Duo:

  • DeviceHelper.IsDualScreenDevice – Call this method before accessing other dual-screen APIs.
  • ScreenHelper.GetCurrentRotation – Get the current rotation value (eg. 0 means 0 degrees, 1 means 90 degrees, 2 means 180 degrees, 3 means 270 degrees).
  • ScreenHelper.IsDualMode – Whether the app is spanned across both screens (and therefore the viewport is partially obscured by the gap between screens).
  • ScreenHelper.GetScreenRectangles – Returns the dimensions of the two screens (in pixels).
  • ScreenHelper.GetHinge – Returns the dimensions of the obscured area of the viewport (in pixels). If the app is not spanned (only showing on a single screen), this will return zero-dimensions since nothing is being obscured.

View sample code for these methods in the Unity ScreenHelper sample. The sample displays device information, as shown in the screenshot below:

Unity game sample showing screen data

Implement the Microsoft dual-screen SDK in Unity

An example of this integration is available on the 2019-LTS-archive branch of the Unity samples repository.

  1. Update mainTemplate.gradle to download the Surface Duo Android SDK:

    maven {
        url ''


    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
        implementation ""
  2. Copy this script SurfaceDuoScreenHelper.cs into your game project.

  3. Use the dual screen methods listed on this page to enhance your game for dual-screen devices.