This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs.
Hello Android dual-screen developers! Today we're excited to share the latest Surface Duo emulator preview. Since our last update, we’ve been busy incorporating feedback and adding new features. What’s new in updated build 2020.710.3:- Support for the Jetpack Window Manager preview
- Bug fixes
Microsoft support for WindowManager in Surface Duo
The Android Jetpack WindowManager addition has recently been updated by Google to support various new mobile form factors like foldable and dual screen devices. Microsoft welcomes these additions. These new AndroidX windowing concepts such as DeviceState and DisplayFeature allow Android application developers to create compelling user experiences for these unique form factors. The Surface Duo device will include androidx.window.sidecar support when it launches and update to androidx.window.extensions when these are officially released, allowing apps to use these new foldable/dual screen AndroidX APIs when running on the Surface Duo and other dual screen devices. Microsoft encourages developers to use the Jetpack library to create dual screen experiences. You can learn more about how to use these APIs by reading the Surface Duo dual-screen documentation, by using dual screen AndroidX based samples, located here and here, and by reading the AndroidX Windowing documentation.Jetpack Window Manager preview
The release of build 2020.710.3 of the Surface Duo Emulator Image is our first preview that includes Android’s dual-screen support using WindowsManager Jetpack library. Read more about it in the Android Developers blog on developing for foldables and in this video.Trying it out
Google’s sample code also included a Window Manager sample that shows how to detect display features (a hinge or fold) and layout screens using just the Jetpack Window Manager package (which is currently in preview). To add this support to your app, add the following dependency to your gradle file: dependencies { implementation "androidx.window:window:1.0.0-alpha01" } You’ll then be able to import the androidx.window.WindowManager and related classes, and use them to detect the hinge and respond to layout changes as the app is spanned and unspanned. You can review the sample code from Google, and see the output here: