Develop for Surface Duo 2

Guy

Hello Android developers!

At yesterday’s Microsoft event we introduced the new Microsoft Surface Duo 2.

Today I’d like to invite developers to start building or enhancing apps for dual-screen devices like the Surface Duo, Surface Duo 2, and other foldables.

Surface Duo 2

The new Surface Duo 2 includes 5G support, three rear-facing cameras (including ultra-wide and telephoto), larger and brighter screens, a faster CPU, and a lot more! Learn more about Surface Duo 2 and pre-order on microsoft.com.

Surface Duo 2

Figure 1: Surface Duo 2

Jetpack Window Manager

The best way to adapt your applications for dual-screen, foldable, and large screen devices is to use Jetpack Window Manager. The FoldingFeature class provides device-specific information so that a single code base can adapt to different dual-screen and foldable devices, including all Surface Duo models.

Hardware differences

For app developers, the hardware differences will not materially affect the way you design and build dual-screen apps – the Jetpack Window Manager APIs will automatically provide the correct information for each device.

Screen size

The new Surface Duo has slightly different dimensions – the individual panes are a little taller and narrower, the hinge area is smaller, but the overall pixel count is larger! The Design Kit has been updated with these values:

Surface Duo 2 screen dimensions diagram

Figure 2: Surface Duo 2 screen dimensions

Resource qualifiers

The screen resolution changes are also reflected in the resource qualifiers you can use to load resources and layouts. The suffix sw720dp-2754×1800 combines the smaller axes from the Surface Duo range to match both devices, or you can create more specific qualifiers using the exact dimensions of each device.

Surface Duo 2 Android emulator

Download and install the latest Surface Duo Android emulator.

Surface Duo 2 Android emulator screenshot

Figure: Surface Duo 2 Android Emulator

The emulator provides a complete dual-screen experience:

  • Running Android 11.
  • Simulates the hinge with a 3D modes view.
  • Supports Jetpack Window Manager APIs for adaptive UI layouts.
  • When used on a touch-screen host device like Microsoft Surface PCs, supports multi-touch and pen sensitivity.
  • Available for Windows, macOS, and Linux.
  • Works with Android Studio, Visual Studio, VSCode, and other IDEs used for Android app development.

Develop like a pro on Surface Laptop Studio

The Surface Duo developer experience team always meets developers where they are at: our emulator and tools run great on Windows, macOS, and Linux and we provide guidance and code samples across a range of Android-supported platforms and languages. For pure developer productivity, the new Surface Laptop Studio will be hard to beat. It has the performance, keyboard, and screen real estate to be a true programmer’s delight, but you can also pull the screen forward and use pressure-sensitive pen or multi-touch gestures to interact with the Android emulator to get an immersive debugging experience.

Surface Laptop Studio
Figure 3: Surface Laptop Studio

Watch Scott Hanselman share his perspective on the Surface Laptop Studio as a developer platform during yesterday’s event.

Developer samples

We have a collection of samples demonstrating how to implement Jetpack Window Manager, or use the enhanced SlidingPaneLayout control to build responsive apps with Kotlin (or Java):

Screenshots from a variety of Surface Duo samples

Figure 4: samples that highlight dual-screen user experiences

Jetpack Compose

We’ve also created guidance for incorporating Window Manager with Jetpack Compose, including a TwoPaneLayout control that provides a responsive foundation for adaptive single-screen, dual-screen, foldable, and large screen Compose user interface layouts.

Surface Duo showing the Jetpack Compose TwoPane sample

Figure 5: Jetpack Compose TwoPaneLayout sample

Cross-platform support

Since the first Surface Duo launch, Microsoft has been committed to enabling developers to take advantage of the dual-screen device category, regardless of which development platform you use. We’ve updated our SDKs, documentation, and samples for Flutter, Xamarin, Unity, Uno Platform, and the web (including PWAs) to support the latest version of Jetpack Window Manager. No matter how you build your Android apps, we’re ready to help you adapt to the dual-screen and foldable ecosystem.

Join us at DroidCon!

The Surface Duo Developer Experience team will be speaking at a number of Android events this year. Visit droidcon.com to register for the conference closest to you, or check out the online options:

Date

Sign up

Topic

October 20th-22nd

Berlin, Germany

Target foldable Android devices using Jetpack Window Manager

October 28th-29th

London, UK

Android foldable and dual-screen device support in Flutter

November 10th-11th

New York, USA

Large screen and foldable UX for Android devices

December 13th-14th

San Francisco, USA

Foldable support in Jetpack Compose

Resources and feedback

If you have any questions, or would like to tell us about your plans for dual-screen and foldable apps, use the feedback forum or message us on Twitter @surfaceduodev

Finally, please join us for our dual screen developer livestream at 11am (Pacific time) each Friday – mark it in your calendar and check out the archives on YouTube.

1 comment

Comments are closed. Login to edit/delete your existing comments

  • Ryan Whitaker

    Hello,
    I don’t have much experience in the software development side of things, but I do have some ideas. I have Surface Duo that I really enjoy, but there are a few things missing.
    1.) A micro SD card slot with support for large capacity micro SD cards (512GB+).
    2.) Better case options to protect the device while in use.
    3.) Make the outside rim of the device out of metal so you don’t have to use the funky adhesive rubber protectors.
    4.) Add a thin rubber piece to each side of each hinge so small bits of debris cannot get in the hinges.
    5.) Include a flush mounted stylus made specifically for the device.
    6.) Upgrade the internal cellular antenna for better reception.

    Adding an additional camera and upgrading the processor are good first steps to the second generation of the device, but it may take a bit more to get me to buy the next one. Overall I really love the experience of having a second screen, and I do highly recommend the Surface Duo.

    Thanks Microsoft Team!