SDKs to build apps for the Surface Duo

There are three different ways you can enhance your apps for the Surface Duo:

  • Dual-screen library - A set of layouts, controls, and helper classes that add dual-screen support to your app.
  • Jetpack Window Manager - Android package that provides APIs for the masked area and hinge angle, which works on foldable devices from different manufacturers (including Surface Duo).
  • Display mask and hinge angle - Surface Duo-specific APIs that help you detect the masked seam area and the hinge angle.

You can include only what you need in your application. See the instructions below to update your Android Studio project.

Dual-screen library layout controls

A library of layout controls and helpers for Kotlin and Java developers:

To access these features add the required dependencies to your app. The library is available based on Jetpack Window Manager or the Display Mask API.

Jetpack Window Manager

Currently in alpha, the Jetpack Window Manager exposes the androidx.window API and supports the Surface Duo as well as foldable devices from other manufacturers.

Add this gradle dependency to include the Window Manager in your app:

dependencies {
    implementation "androidx.window:window:1.0.0-alpha01"
}

Follow our Jetpack Window Manager guidance to use the API directly, or add dual-screen library and use the layouts and controls provided.

Display mask and hinge angle

Follow these steps to add the Display Mask API to your Kotlin or Java app:

  1. In the top-level build.gradle file, add these lines inside the allprojects { repositories { section:

    maven {
        url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
    }
    
  2. In your module-level build.gradle file, add these lines in the dependencies { section:

    implementation "com.microsoft.device.display:display-mask:0.3.0"
    
  3. Java projects should also add this line to their build.gradle dependencies, because the library is built with Kotlin (note that the $kotlin_version will need to be defined as well):

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    

This provides the following features:

Higher level layout changes must be built by the app developer. See the dual-screen libraries for layout controls that help enhance your apps automatically.

Next steps