{"id":1584,"date":"2021-05-28T10:34:00","date_gmt":"2021-05-28T17:34:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=1584"},"modified":"2021-05-28T12:34:18","modified_gmt":"2021-05-28T19:34:18","slug":"ask-the-experts-at-microsoft-build-2021","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/ask-the-experts-at-microsoft-build-2021\/","title":{"rendered":"Ask the Experts at Microsoft Build"},"content":{"rendered":"<p>\n  Hello developers!\n<\/p>\n<p>\n  Thank you to everyone who joined us at Microsoft Build this week. There was a lot of amazing announcements across the company, but for the Surface Duo Developer Experience team the highlight was sharing the latest info on building and enhancing your apps for dual-screens, and \u201cmeeting\u201d everyone who attended the live Ask The Experts session. We really appreciate the passion of the developer community and look forward to talking with you more at future events.\n<\/p>\n<p>\n<a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200.png\" alt=\"Panel headshots: Guy, Nitya, Cesar, Craig, Joy, Mehul, Hakon, Andrei\" width=\"1200\" height=\"638\" class=\"alignnone size-full wp-image-1591\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200.png 1200w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200-300x160.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200-1024x544.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/05\/ask-the-experts-1200-768x408.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>\n  Until then, here\u2019s a summary of the top questions and answers from the session (which is also available to <a href=\"https:\/\/aka.ms\/buildduoate\">watch online<\/a>).\n<\/p>\n<h2>Are the dual-screen APIs Surface Duo-specific or are becoming standardized across all foldables?<\/h2>\n<p>\n  Early last year when we introduced the Surface Duo SDK, we released the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/display-mask\">DisplayMask package<\/a> which only works on Surface Duo. This library provided a stable platform upon which to build dual-screen applications for Surface Duo.\n<\/p>\n<p>\n  Around the same time, Google released the first alpha version of <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/platform\/jetpack-window-manager\">Jetpack Window Manager<\/a>, which is a standardized API for all types of dual-screen and foldable devices, including the Surface Duo and foldables from other manufacturers. Window Manager is currently at version alpha06 and we are incorporating it into our <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/\">dual-screen SDK<\/a> so that developers can maximize the benefits of enhancing their apps once it\u2019s stable.\n<\/p>\n<p>\n  Surface Duo fully supports both APIs and we encourage adoption of Jetpack Window Manager once it&#8217;s stable.\n<\/p>\n<h2>After adding multi-instance support, what would you recommend as the next easiest step to make existing apps better on the Surface Duo? <\/h2>\n<p>\n  A couple of minor changes that you could add and that will make your app shine on dual-screen and foldable form factors are drag and drop, which will allow you get rich data coming from other apps that have implemented that functionality or to provide data to others.\n<\/p>\n<p>\n  Launching a new Activity to the adjacent screen is also a really powerful option for dual-screen devices. Your app will be able to launch new Activities to the adjacent screen when this is empty, so your users are not taken out of the flow (e.g. reading an article and taping on a link it would be launched to the adjacent screen while your users still have the focus on the article they were reading.\n<\/p>\n<p>\n  Having said that, if you want to take advantage of having your app spanned across displays you can show an adapted UI for that mode. We provide a series of different components such as <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/layouts\/surfaceduo-layout\">SurfaceDuoLayout<\/a>, BottomNavigation, etc. that will help you to create nice dual screen experiences.\n<\/p>\n<p>\nGoogle has also embraced large screen, foldable, and dual-screen devices and created a bunch of new components such as <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/foldable-slidingpanelayout-preview\/\">SlidingPaneLayout<\/a> and updates in ConstraintLayout that will also help you support foldable and dual-screen devices.\n<\/p>\n<h2>Can I use Kotlin Multiplatform Mobile (KMM) to build dual-screen apps?<\/h2>\n<p>\n  Yes, you totally can use it. Surface Duo runs Android and you can use any programming language or framework used to create Android apps. \n<\/p>\n<p>\n  We would like to highlight that Surface Duo supports Jetpack Window Manager in order to work with the specific capabilities of the device, such as the physical hinge or the different postures. Since Jetpack Window Manager is used as well on other foldable devices, you can create your new experiences that work well across these new form factor devices so you can take even more advantage of your single Kotlin Multiplatform codebase.\n<\/p>\n<h2>Will .NET Multi-platform App UI (.NET MAUI) support dual-screen devices?<\/h2>\n<p>\n  When the .NET Multi-platform App UI (.NET MAUI) ships later this year, it will have the same dual-screen support <a href=\"https:\/\/docs.microsoft.com\/xamarin\/xamarin-forms\/app-fundamentals\/dual-screen\/\">currently available in Xamarin.Forms<\/a>. The goal, as with the entire .NET MAUI platform, is to make updating from Xamarin.Forms as seamless as possible, so it should just be a matter of changing namespaces.\n<\/p>\n<p>\n  The Xamarin team announced <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-maui-preview-4\/\">Preview 4 at Build<\/a> (which you can download today). TwoPaneView is not currently in available the preview but keep an eye on <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/\">this blog<\/a> for future updates.\n<\/p>\n<h2>How difficult is it to take an existing Xamarin.Forms app and add dual-screen support?<\/h2>\n<p>\nAt a high level, all you need to do is add the dual-screen support NuGet and adapt your layouts using the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/xamarin\/dualscreeninfo\">DualScreenInfo<\/a> helper class, or use the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dual-screen\/xamarin\/twopaneview\">TwoPaneView<\/a> layout control in your content pages. Craig\u2019s session <a href=\"https:\/\/aka.ms\/buildduoxamarin\">Developing dual-screen apps with Xamarin and Xamarin.Forms<\/a> walks through the processing of updating an existing Xamarin.Forms app for Surface Duo. There is also a free Microsoft Learn module <a href=\"https:\/\/docs.microsoft.com\/learn\/modules\/xamarin-forms-dual-screen\/\">Build dual-screen Xamarin.Forms apps by using TwoPaneView<\/a> which walks through the process using one of our sample apps.\n<\/p>\n<p>\n  You can also check out the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/xamarin\/\">Surface Duo documentation for Xamarin<\/a> for tips and links to samples.\n<\/p>\n<h2>Are the web APIs stable yet? I want to enhance my web app to support dual screen.<\/h2>\n<p>\n  Unfortunately the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dual-screen\/web\/\">dual-screen web APIs<\/a> are not yet stable, and must be <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/web\/emulator-device-testing\">enabled via edge:\/\/flags<\/a> in Microsoft Edge on the Surface Duo. You can also test dual-screen web features in desktop Edge or Chrome.\n<\/p>\n<p>\n  The good news is that  you can still release a dual-screen web app using an <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/dual-screen-website-edge-origin-trials\/\">Origin Trial token<\/a>. Signing up for a token and placing it in your HTML or response headers will \u201cswitch on\u201d the dual-screen web APIs for your site. \n<\/p>\n<p>\n  Just remember the APIs are still considered under development, so if any tweaks are made to the standards, watch the <a href=\"https:\/\/blogs.windows.com\/msedgedev\/\">Edge developer blog<\/a> (and the <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/\">Surface Duo developer blog<\/a>) for information and keep your code updated!\n<\/p>\n<h2>Are there SDKs for the web or is it a vanilla JavaScript API? Most importantly, does it support Progressive Web Apps?<\/h2>\n<p>\n  There are two parts to the dual-screen web API: CSS and JavaScript. The <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/web\/css-media-spanning\">CSS support<\/a> is in the form of media queries for when the browser is spanned across the entire screen of a dual-screen device. There are also environment variables you can use in your styles to arrange elements around the hinge.\n<\/p>\n<p>\n  The <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/web\/javascript-getwindowsegments\">JavaScript support<\/a> is via a method <strong>getWindowSegments<\/strong> which returns an array of rectangle coordinates for each screen that the page is rendering on. You can check this method on events like resize and use the screen dimensions to adjust your layout for dual-screen devices.\n<\/p>\n<p>\n  Progressive Web Apps (PWAs) are also supported \u2013 there\u2019s a blog post <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/dual-screen-pwa\/\">Build and deploy dual-screen progressive web apps<\/a> that walks you through the details, including some sample dual-screen PWAs.\n<\/p>\n<h2>For new Surface Duo apps, would you recommend going straight to Compose or use the \u201ctraditional\u201d way?<\/h2>\n<p>\n  It depends on where your experience lies. If you are coming from React, Flutter or iOS SwiftUI, Compose will be a very good option for you due to the nature of the declarative UI and similar syntax. But if the timeline is tight, it will be more pragmatic to stick with the &#8220;tranditional&#8221; way if you&#8217;ve been doing it for a while.\n<\/p>\n<p>\n  Many developers enjoy its conciseness and flexibility for dual-screen development. Compose is in beta now and will become stable this July. It is a great time to have a try it out, even not using it for production apps (yet!).\n<\/p>\n<h2>How are the dual-screen PRs for the Flutter framework going?<\/h2>\n<p>\n  We are really happy with the positive feedback we\u2019ve received on the foldable support that\u2019s been proposed for Flutter. Since Flutter is open-source, you can view our pull-requests directly (see the <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/flutter-dual-screen-foldable\/\">Flutter support for foldable devices<\/a> announcement for details). The new APIs are based on Jetpack Window Manager which is currently at version alpha06. As it moves to beta and stable, the Flutter team will be in a position to move the foldable support forward into the core.\n<\/p>\n<p>\n  If you\u2019re a Flutter developer that\u2019s interested in building apps for foldable devices, we\u2019d love to hear from you (via <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a> or on <a href=\"https:\/\/twitter.com\/seaotta\">Twitter<\/a>) about your requirements.\n<\/p>\n<h2>Any design tips for creating beautiful Surface Duo dual-screen apps?<\/h2>\n<p>\n  We have lots of resources for UX designers working on dual-screen apps, including <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/introduction\">documentation<\/a> that covers common app patterns and the <a href=\"https:\/\/aka.ms\/SurfaceDuoDesign\">Surface Duo Design Kit in Figma<\/a> which covers the patterns but also includes device frames, controls guidance, and more. There are also dual-screen enhanced <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/fluent-ui\/\">Microsoft Fluent UI Android<\/a> controls that you can add to your app, and of course you can take full advantage of Material Design in your Android apps.\n<\/p>\n<h2>Resources and feedback<\/h2>\n<p>\n  All the Surface Duo sessions at Microsoft Build 2021 were recorded and are available to view online:\n<\/p>\n<table>\n<tr>\n<td>\n<p><a href=\"https:\/\/aka.ms\/buildduoate\">Ask the experts: What\u2019s new for developers building dual-screen apps for the Surface Duo<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/andreidiaconu\">Andrei Diaconu<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/cesarvaliente\">Cesar Valiente<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/conceptdev\">Craig Dunn<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/gmerin\">Guy Merin<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/HakonStrande\">Hakon Strande<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/joyl_liu\">Joy Liu<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/mehulshah1995\">Mehul Shah<\/a>\n<\/p>\n<p><a href=\"https:\/\/twitter.com\/nitya\">Nitya Narasimhan<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><a href=\"https:\/\/aka.ms\/buildduo\">Tips and tricks: App development for dual-screen and Android<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/joyl_liu\">Joy Liu<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=ByFqyNPdNNA\">Application design and development for Android dual-screen and foldable devices<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/gmerin\">Guy Merin<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><a href=\"https:\/\/aka.ms\/buildduoxamarin\">Developing dual-screen apps with Xamarin and Xamarin.Forms<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/conceptdev\">Craig Dunn<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><a href=\"https:\/\/aka.ms\/buildduowebapps\">Developing dual-screen web apps<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/seaotta\">Stephanie Stimac<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><a href=\"https:\/\/aka.ms\/buildduosdk\">Dual-screen native SDKs and samples<\/a>\n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/twitter.com\/cesarvaliente\">Cesar Valiente<\/a>\n<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p>\n  If you have any questions, or would like to tell us about your apps, use <a id=\"post-1584-_Hlk73085519\"><\/a>the <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a> or message us on <a href=\"https:\/\/twitter.com\/seaotta\">Twitter @surfaceduodev.<\/a>\n<\/p>\n<p>\n  Finally, please join us for our dual-screen developer livestream at 11am PST each Friday at <a href=\"https:\/\/www.twitch.tv\/surfaceduodev\">twitch.tv\/surfaceduodev<\/a> and check out the archives on <a href=\"https:\/\/www.youtube.com\/channel\/UClGu9QLtPNz8OdddBfhZXPA\">YouTube<\/a>. This week we\u2019ll review all the latest news from Build.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello developers! Thank you to everyone who joined us at Microsoft Build this week. There was a lot of amazing announcements across the company, but for the Surface Duo Developer Experience team the highlight was sharing the latest info on building and enhancing your apps for dual-screens, and \u201cmeeting\u201d everyone who attended the live Ask [&hellip;]<\/p>\n","protected":false},"author":18491,"featured_media":1591,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[365,693,705,412,692,473,182],"class_list":["post-1584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-android-developer","tag-flutter","tag-java","tag-javascript","tag-jetpack-compose","tag-kotlin","tag-xamarin-forms"],"acf":[],"blog_post_summary":"<p>Hello developers! Thank you to everyone who joined us at Microsoft Build this week. There was a lot of amazing announcements across the company, but for the Surface Duo Developer Experience team the highlight was sharing the latest info on building and enhancing your apps for dual-screens, and \u201cmeeting\u201d everyone who attended the live Ask [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/1584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/18491"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=1584"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/1584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/1591"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=1584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=1584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=1584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}