{"id":953,"date":"2020-10-08T11:27:49","date_gmt":"2020-10-08T18:27:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=953"},"modified":"2020-10-08T11:27:49","modified_gmt":"2020-10-08T18:27:49","slug":"developing-for-accessories","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/developing-for-accessories\/","title":{"rendered":"Developing for Microsoft Surface Duo accessories"},"content":{"rendered":"<p>\n  Hello Surface Duo developers,\n<\/p>\n<p>\n  Microsoft <a href=\"https:\/\/blogs.windows.com\/devices\/2020\/10\/01\/introducing-surface-laptop-go-new-updates-to-surface-pro-x-and-new-accessories\/\">recently announced<\/a> new Surface devices and accessories, so this week we\u2019re looking at some of the <a href=\"https:\/\/www.microsoft.com\/store\/b\/surface-accessories\">accessories that work with Surface Duo<\/a> and how you can accommodate them in your apps.\n<\/p>\n<h2>Microsoft Surface Pens<\/h2>\n<p>\n  The <a href=\"https:\/\/www.microsoft.com\/p\/surface-slim-pen\/8mn7mp9nqdlk?activetab=overview\">Surface Slim Pen<\/a> and <a href=\"https:\/\/www.microsoft.com\/p\/surface-pen\/92fp8q09qhxc\">Surface Pen<\/a> both work great with the Surface Duo, whether you\u2019re drawing, note-taking, or just prefer to navigate with a pen. Microsoft OneNote provides a great experience for writing on the Surface Duo.\n<\/p>\n<p>\n  <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accesssory-pens.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accesssory-pens.png\" alt=\"Surface Slim Pen and Surface Pen\" width=\"624\" height=\"124\" class=\"alignnone size-full wp-image-956\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accesssory-pens.png 624w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accesssory-pens-300x60.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/a><br\/><em>Figure 1: Surface Slim Pen and Surface Pen<\/em>\n<\/p>\n<p>\n  To build inking support in your own apps, check out the <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/noteworthy-new-app-sample-twonote\/\">TwoNote sample app<\/a> for example code to create a pressure-sensitive drawing experience, and the <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/hinge-angle-on-surface-duo\/\">hinge-angle sample<\/a> for a fun take on drawing.\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"609\" height=\"772\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/word-image-10.png\" class=\"wp-image-954\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/word-image-10.png 609w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/word-image-10-237x300.png 237w\" sizes=\"(max-width: 609px) 100vw, 609px\" \/><br\/><em>Figure 2: TwoNote drawing demo<\/em>\n<\/p>\n<p>\n  Xamarin developers should check out the <a href=\"https:\/\/docs.microsoft.com\/samples\/xamarin\/app-xamarintv\/app\/\">Xamarin TV<\/a> sample, which includes a note-taking feature as part of the code.\n<\/p>\n<h2>Bluetooth keyboards<\/h2>\n<p>\n  Bluetooth keyboards such as the <a href=\"https:\/\/www.microsoft.com\/p\/microsoft-designer-compact-keyboard\/8zhrtr7zcswq\">Microsoft Designer Compact Keyboard<\/a> can be paired with the Surface Duo for a desktop-like data-entry experience, and the added bonus of both screens being entirely devoted to your apps and data. \n<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-keyboard.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-keyboard.png\" alt=\"Microsoft Designer Compact Keyboard\" width=\"650\" height=\"289\" class=\"alignnone size-full wp-image-957\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-keyboard.png 650w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-keyboard-300x133.png 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><br\/><em>Figure 3: Microsoft Designer Compact Keyboard<\/em>\n<\/p>\n<p>\n  There\u2019s nothing you need to do in your apps to facilitate a paired keyboard, but check out the <a href=\"https:\/\/github.com\/microsoft\/surface-duo-sdk-samples\/tree\/master\/OrientationAndSpanning\">Orientation and Spanning<\/a> sample to learn how the keyboard insets can be used to check whether an on-screen keyboard is visible and adjust your views appropriately. You can enhance your app\u2019s <a href=\"https:\/\/developer.android.com\/training\/keyboard-input\/navigation\">keyboard navigation<\/a> by using the <strong>nextFocusForward<\/strong> attribute for handling tab order, or <strong>nextFocus*<\/strong> attributes for arrow-key navigation. You can also <a href=\"https:\/\/developer.android.com\/training\/keyboard-input\/commands\">handle key presses<\/a> with <strong>onKeyDown<\/strong> and <strong>onKeyUp<\/strong>, including modifier keys by checking <strong>isShiftPressed<\/strong> or <strong>isCtrlPressed<\/strong>.\n<\/p>\n<p>\n  Surface Duo owners are already taking advantage of paired keyboards in a number of ways, from writing code on the go with <a href=\"https:\/\/visualstudio.microsoft.com\/services\/github-codespaces\/\">GitHub Codespaces<\/a> in Microsoft Edge, to remotely accessing desktop and server computers.\n<\/p>\n<h2>Bluetooth mice<\/h2>\n<p>\n  For a complete desktop productivity experience, you can also pair a <a href=\"https:\/\/www.microsoft.com\/en-us\/p\/surface-mobile-mouse\/8sjjqt4l40xx?activetab=pivot%3aoverviewtab\">Surface Mobile Mouse<\/a> or <a href=\"https:\/\/www.microsoft.com\/en-us\/p\/surface-arc-mouse\/8mrmszc6vxkc\">Surface Arc Mouse<\/a>. When a mouse is paired, a pointer will appear on the screen to allow you to easily navigate and select items on the Surface Duo. The scroll-wheel will also work where supported \u2013 you can handle scroll events in your code via the <a href=\"https:\/\/developer.android.com\/reference\/android\/view\/MotionEvent#ACTION_SCROLL\">ACTION_SCROLL MotionEvent<\/a>.\n<\/p>\n<p>\n  <a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-mice.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-mice.png\" alt=\"Surface Mobile Mouse and Surface Arc Mouse\" width=\"612\" height=\"198\" class=\"alignnone size-full wp-image-959\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-mice.png 612w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-mice-300x97.png 300w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/a><br\/><em>Figure 4: Surface Mobile Mouse and Surface Arc Mouse<\/em>\n<\/p>\n<h2>Bluetooth headphones<\/h2>\n<p>\n  Audio accessories like the <a href=\"https:\/\/www.microsoft.com\/p\/surface-earbuds\/8r9cpq146064\">Surface Earbuds<\/a> pair easily with the Surface Duo. Apps don\u2019t need to do anything different to access these accessories \u2013 Android takes care of routing the audio input and output between your app and paired devices. Whether your app is a simple productivity tool or a 3D game, take advantage of the audio capabilities of the Surface Duo to provide feedback and provide an immersive user experience.\n<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-earbuds.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-earbuds.png\" alt=\"Surface Earbuds\" width=\"495\" height=\"222\" class=\"alignnone size-full wp-image-960\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-earbuds.png 495w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2020\/10\/accessory-earbuds-300x135.png 300w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/a><br\/><em>Figure 5: Surface Earbuds<\/em>\n<\/p>\n<h2>Feedback<\/h2>\n<p>\n  We\u2019d love to hear how you\u2019re adapting your apps for the dual-screen Surface Duo, including inking support and adapting to other accessories.\n<\/p>\n<p>\n  Please reach out to our team using the <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\" target=\"_blank\" rel=\"noopener noreferrer\">feedback forum<\/a> or <a href=\"https:\/\/twitter.com\/surfaceduodev\" target=\"_blank\" rel=\"noopener noreferrer\">Twitter<\/a>. You can also reach me on <a href=\"https:\/\/twitter.com\/conceptdev\" target=\"_blank\" rel=\"noopener noreferrer\">Twitter<\/a> or\u00a0<a href=\"https:\/\/github.com\/conceptdev\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Surface Duo developers, Microsoft recently announced new Surface devices and accessories, so this week we\u2019re looking at some of the accessories that work with Surface Duo and how you can accommodate them in your apps. Microsoft Surface Pens The Surface Slim Pen and Surface Pen both work great with the Surface Duo, whether you\u2019re [&hellip;]<\/p>\n","protected":false},"author":570,"featured_media":962,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[701,366,46],"class_list":["post-953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-accessories","tag-pen","tag-surface-duo"],"acf":[],"blog_post_summary":"<p>Hello Surface Duo developers, Microsoft recently announced new Surface devices and accessories, so this week we\u2019re looking at some of the accessories that work with Surface Duo and how you can accommodate them in your apps. Microsoft Surface Pens The Surface Slim Pen and Surface Pen both work great with the Surface Duo, whether you\u2019re [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/953","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\/570"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=953"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/962"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}