{"id":1891,"date":"2021-09-23T11:39:24","date_gmt":"2021-09-23T18:39:24","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=1891"},"modified":"2021-09-23T11:39:24","modified_gmt":"2021-09-23T18:39:24","slug":"develop-for-surface-duo-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/develop-for-surface-duo-2\/","title":{"rendered":"Develop for Surface Duo 2"},"content":{"rendered":"<p>\n  Hello Android developers!\n<\/p>\n<p>\n  At yesterday\u2019s <a href=\"https:\/\/www.microsoft.com\/event\">Microsoft event<\/a> we <a href=\"https:\/\/youtu.be\/phzyut897PI?t=1403\">introduced<\/a> the new Microsoft Surface Duo 2.\n<\/p>\n<p>\n  Today I\u2019d like to invite developers to start building or enhancing apps for dual-screen devices like the Surface Duo, Surface Duo 2, and other foldables.\n<\/p>\n<h2>Surface Duo 2<\/h2>\n<p>\n  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 <a href=\"https:\/\/www.microsoft.com\/d\/surface-duo-2\/9408kgxp4xjl\">microsoft.com<\/a>.\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"1002\" height=\"820\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-2.png\" class=\"wp-image-1892\" alt=\"Surface Duo 2\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-2.png 1002w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-2-300x246.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-2-768x629.png 768w\" sizes=\"(max-width: 1002px) 100vw, 1002px\" \/>\n<\/p>\n<p><em>Figure 1: Surface Duo 2<\/em>\n<\/p>\n<h2>Jetpack Window Manager<\/h2>\n<p>\n  The best way to adapt your applications for dual-screen, foldable, and large screen devices is to use <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/jetpack\/window-manager\/\">Jetpack Window Manager<\/a>. 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.\n<\/p>\n<h2>Hardware differences<\/h2>\n<p>\n  For app developers, the hardware differences will not materially affect the way you design and build dual-screen apps \u2013 the Jetpack Window Manager APIs will automatically provide the correct information for each device.\n<\/p>\n<h3>Screen size<\/h3>\n<p>\n  The new Surface Duo has <em>slightly<\/em> different <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/duo-dimensions\">dimensions<\/a> \u2013 the individual panes are a little taller and narrower, the hinge area is smaller, but the overall pixel count is larger! The <a href=\"https:\/\/aka.ms\/SurfaceDuoDesign\">Design Kit<\/a> has been updated with these values:\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"788\" height=\"559\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/diagram-description-automatically-generated.png\" class=\"wp-image-1893\" alt=\"Surface Duo 2 screen dimensions diagram\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/diagram-description-automatically-generated.png 788w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/diagram-description-automatically-generated-300x213.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/diagram-description-automatically-generated-768x545.png 768w\" sizes=\"(max-width: 788px) 100vw, 788px\" \/>\n<\/p>\n<p><em>Figure 2: Surface Duo 2 screen dimensions<\/em>\n<\/p>\n<h3>Resource qualifiers<\/h3>\n<p>\n  The screen resolution changes are also reflected in the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/platform\/resource-qualifier\">resource qualifiers<\/a> you can use to load resources and layouts. The suffix <strong>sw720dp-2754\u00d71800<\/strong> 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.\n<\/p>\n<h2>Surface Duo 2 Android emulator<\/h2>\n<p><a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/emulator\/surface-duo-download\">Download and install<\/a> the latest Surface Duo Android emulator. \n<\/p>\n<p>\n  <img decoding=\"async\" width=\"2500\" height=\"1773\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1.png\" class=\"wp-image-1894\" alt=\"Surface Duo 2 Android emulator screenshot\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1.png 2500w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1-300x213.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1-1024x726.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1-768x545.png 768w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1-1536x1089.png 1536w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/graphical-user-interface-application-description-1-2048x1452.png 2048w\" sizes=\"(max-width: 2500px) 100vw, 2500px\" \/>\n<\/p>\n<p><em>Figure: Surface Duo 2 Android Emulator <\/em>\n<\/p>\n<p>\n  The emulator provides a complete dual-screen experience:\n<\/p>\n<ul>\n<li>\n    Running Android 11.\n  <\/li>\n<li>\n    Simulates the hinge with a 3D modes view.\n  <\/li>\n<li>\n    Supports Jetpack Window Manager APIs for adaptive UI layouts.\n  <\/li>\n<li>\n    When used on a touch-screen host device like Microsoft Surface PCs, supports multi-touch and pen sensitivity.\n  <\/li>\n<li>\n    Available for Windows, macOS, and Linux.\n  <\/li>\n<li>\n    Works with Android Studio, Visual Studio, VSCode, and other IDEs used for Android app development.\n  <\/li>\n<\/ul>\n<h2>Develop like a pro on Surface Laptop Studio<\/h2>\n<p>\n  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 <a href=\"https:\/\/www.microsoft.com\/d\/surface-laptop-studio\/8SRDF62SWKPF\">Surface Laptop Studio<\/a> will be hard to beat. It has the performance, keyboard, and screen real estate to be a true programmer\u2019s 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.\n<\/p>\n<p>\n  <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42.png\" alt=\"Surface Laptop Studio\" width=\"1196\" height=\"691\" class=\"alignnone size-full wp-image-1900\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42.png 1196w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42-300x173.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42-1024x592.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/image42-768x444.png 768w\" sizes=\"(max-width: 1196px) 100vw, 1196px\" \/><\/a><br \/><em>Figure 3: Surface Laptop Studio<\/em>\n<\/p>\n<p><a href=\"https:\/\/youtu.be\/phzyut897PI?t=2413\">Watch Scott Hanselman<\/a> share his perspective on the Surface Laptop Studio as a developer platform during yesterday\u2019s event.\n<\/p>\n<h2>Developer samples<\/h2>\n<p>\n  We have a <a href=\"https:\/\/github.com\/microsoft\/surface-duo-window-manager-samples\">collection of samples<\/a> demonstrating how to implement <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/jetpack\/window-manager\/\">Jetpack Window Manager<\/a>, or use the enhanced SlidingPaneLayout control to build responsive apps with Kotlin (or Java):\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"776\" height=\"1100\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-4.png\" class=\"wp-image-1896\" alt=\"Screenshots from a variety of Surface Duo samples\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-4.png 776w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-4-212x300.png 212w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-4-722x1024.png 722w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/word-image-4-768x1089.png 768w\" sizes=\"(max-width: 776px) 100vw, 776px\" \/>\n<\/p>\n<p><em>Figure 4: samples that highlight dual-screen user experiences<\/em>\n<\/p>\n<h2>Jetpack Compose<\/h2>\n<p>\n  We\u2019ve also created guidance for incorporating Window Manager with Jetpack Compose, including a <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/jetpack\/compose\/two-pane-layout\">TwoPaneLayout<\/a> control that provides a responsive foundation for adaptive single-screen, dual-screen, foldable, and large screen Compose user interface layouts.\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"348\" height=\"282\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/a-picture-containing-text-electronics-display-s.png\" class=\"wp-image-1897\" alt=\"Surface Duo showing the Jetpack Compose TwoPane sample\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/a-picture-containing-text-electronics-display-s.png 348w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2021\/09\/a-picture-containing-text-electronics-display-s-300x243.png 300w\" sizes=\"(max-width: 348px) 100vw, 348px\" \/>\n<\/p>\n<p><em>Figure 5: Jetpack Compose TwoPaneLayout sample<\/em>\n<\/p>\n<h2>Cross-platform support<\/h2>\n<p>\n  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\u2019ve updated our SDKs, documentation, and samples for <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/flutter\/\">Flutter<\/a>, <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/xamarin\/jetpack-window-manager\">Xamarin<\/a>, <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/unity\/jetpack-window-manager\">Unity<\/a>, 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\u2019re ready to help you adapt to the dual-screen and foldable ecosystem.\n<\/p>\n<h2>Join us at DroidCon!<\/h2>\n<p>\n  The Surface Duo Developer Experience team will be speaking at a number of Android events this year. Visit <a href=\"https:\/\/www.droidcon.com\/\">droidcon.com<\/a> to register for the conference closest to you, or check out the online options:\n<\/p>\n<table>\n<tr>\n<td>\n<p><strong>Date<\/strong>\n<\/p>\n<\/td>\n<td>\n<p><strong>Sign up<\/strong>\n<\/p>\n<\/td>\n<td>\n<p><strong>Topic<\/strong>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\n  October 20<sup>th<\/sup>-22<sup>nd<\/sup> \n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/www.berlin.droidcon.com\/\">Berlin<\/a>, Germany\n<\/p>\n<\/td>\n<td>\n<p>\n  Target foldable Android devices using Jetpack Window Manager\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\n  October 28<sup>th<\/sup>-29<sup>th<\/sup> \n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/www.london.droidcon.com\/\">London<\/a>, UK\n<\/p>\n<\/td>\n<td>\n<p>\n  Android foldable and dual-screen device support in Flutter\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\n  November 10<sup>th<\/sup>-11<sup>th<\/sup> \n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/www.nyc.droidcon.com\/\">New York<\/a>, USA\n<\/p>\n<\/td>\n<td>\n<p>\n  Large screen and foldable UX for Android devices\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\n  December 13<sup>th<\/sup>-14<sup>th<\/sup> \n<\/p>\n<\/td>\n<td>\n<p><a href=\"https:\/\/www.sf.droidcon.com\/\">San Francisco<\/a>, USA\n<\/p>\n<\/td>\n<td>\n<p>\n  Foldable support in Jetpack Compose\n<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>Resources and feedback<\/h2>\n<p>\n  If you have any questions, or would like to tell us about your plans for dual-screen and foldable apps, use the\u00a0<a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a>\u00a0or message us on Twitter\u00a0<a href=\"https:\/\/twitter.com\/surfaceduodev\">@surfaceduodev<\/a>.\u00a0\n<\/p>\n<p>\n  Finally, please join us for our <a href=\"https:\/\/twitch.tv\/surfaceduodev\">dual screen developer livestream<\/a> at 11am (Pacific time) each Friday \u2013 mark it in your calendar and check out the <a href=\"https:\/\/www.youtube.com\/channel\/UClGu9QLtPNz8OdddBfhZXPA\">archives on YouTube<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Android developers! At yesterday\u2019s Microsoft event we introduced the new Microsoft Surface Duo 2. Today I\u2019d 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 [&hellip;]<\/p>\n","protected":false},"author":17398,"featured_media":1892,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[31,46],"class_list":["post-1891","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-dual-screen-development","tag-surface-duo"],"acf":[],"blog_post_summary":"<p>Hello Android developers! At yesterday\u2019s Microsoft event we introduced the new Microsoft Surface Duo 2. Today I\u2019d 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/1891","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\/17398"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=1891"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/1891\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/1892"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=1891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=1891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=1891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}