Dual-screen developer tools recap
Hello dual-screen developers,
Each week we cover a different aspect of dual-screen development, but with so much happening it’s difficult to cover ALL of the platforms that support the Microsoft Surface Duo. This post is a quick run-down of all the different tools and platforms that developers can use to create dual-screen experiences on Android.
Surface Duo Android emulator
The free Surface Duo emulator image download makes it easy to get started with dual-screen development. It works with all the different developer platforms and provides a complete dual-screen experience, including the ability to simulate folding in the properties window:
Check out the emulator docs for more information on how to set-up and use the emulator with your favorite IDE.
Kotlin & Java
Developers using Android Studio with Kotlin and Java have a variety of options available to enhance their apps for dual-screen and foldable devices. Our team has built a dual-screen library that includes a SurfaceDuoLayout control, and improved tabs, bottom navigation, frame, and other helpers. The library can swap between Microsoft’s stable DisplayMask API or the Jetpack Window Manager alpha release if you’d like to begin testing on other foldable devices.
We’re also working on a pen and ink SDK to help add support for pen hardware features.
Web and PWA
These APIs are also supported in Progressive Web Apps (PWAs) so you can deploy your web creations to Google Play!
Xamarin, Xamarin.Forms, and .NET
Xamarin.Forms developers can easily adapt their user interface for Surface Duo using the TwoPaneView layout control, which is part of the Xamarin.Forms.DualScreen NuGet package. It also includes a DualScreenInfo helper class if you prefer to work with the screen information directly. There are a number of C# samples available, including the fully featured open-source app Sketch 360:
Xamarin developers can also give the Jetpack Window Manager preview a try using the AndroidX.WindowManager NuGet. This allows Xamarin.Android developers to experiment with the API that works across a variety foldable and dual-screen devices while it’s still in alpha.
Earlier this year (at Google I/O) we announced that we were helping bring foldable support to Flutter. The pull requests are available for review and feedback while Jetpack Window Manager (on which it is based) matures.
Separately, we published the dual_screen package on pub.dev. It brings dual-screen and foldable devices hinge angle into Flutter applications.
Game developers can take advantage of our DisplayMask API using this sample code. We also have a branch available using the Jetpack Window Manager alpha if you want to give that a try on different foldable devices: