{"id":6079,"date":"2021-03-09T12:39:10","date_gmt":"2021-03-09T20:39:10","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=6079"},"modified":"2021-03-09T12:39:10","modified_gmt":"2021-03-09T20:39:10","slug":"4-device-capabilities-developers-can-utilize-for-microsoft-teams-mobile-apps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/4-device-capabilities-developers-can-utilize-for-microsoft-teams-mobile-apps\/","title":{"rendered":"Four device capabilities developers can utilize for Microsoft Teams mobile apps"},"content":{"rendered":"<p>Microsoft Teams is designed to \u201cmeet users where they are\u201d \u2013 enhancing productivity and collaboration no matter where you are or how you work. And customers are using Teams and its ecosystem of apps to support diverse work scenarios that support their unique needs, such as a growing need for mobile-first scenarios. To meet these needs, developers need tools and resources to build innovative Teams apps for both desktop and mobile.<\/p>\n<p>That\u2019s where the <a href=\"https:\/\/docs.microsoft.com\/en-us\/javascript\/api\/overview\/msteams-client?view=msteams-client-js-latest&amp;preserve-view=true\">Microsoft Teams JavaScript client SDK<\/a> fits in and is a tool you should utilize as you build your Teams app. It\u2019s a toolkit that makes it easy to integrate your own services within Teams for desktop and mobile app development. We are excited to share <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/device-capabilities-overview?view=msteams-client-js-latest\">four device capabilities<\/a> &#8211; image, microphone, location, QR\/Barcode scanner &#8211; that you can now utilize to light up new and compelling scenarios. These high-value experiences come out-of-box in the SDK and can be leveraged with minimal effort, reducing the barrier to app development.<\/p>\n<h4>Before you get started<\/h4>\n<p>Before we jump into these great device capabilities to take advantage of, you\u2019ll need to <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/native-device-permissions?view=msteams-client-js-latest&amp;tabs=desktop\">request device permissions to access native device capabilities<\/a>. The Teams JavaScript client SDK will provide all the tools necessary for your Teams mobile app to access the user\u2019s device permissions. With a few updates to your app\u2019s manifest, you\u2019ll be on your way.<\/p>\n<h4>Capture or select media from the device camera<\/h4>\n<p>For scenarios that you want to build involving device camera or photo gallery, <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/mobile-camera-image-permissions?view=msteams-client-js-latest#media-capability-apis\">we\u2019ve introduced the selectMedia() API<\/a>. This API allows users to capture or select media from the device camera and return it to the web-app. In response to selectMedia, the web-app receives the media IDs of selected images and a thumbnail of the selected media. The native camera control is powered by Microsoft Office Lens SDK which allows for advanced functionalities such as scanning documents and whiteboard, letting users leverage edit features such as crop, rotate and annotate over an image.<\/p>\n<p>You can <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/mobile-camera-image-permissions?view=msteams-client-js-latest#code-snippets\">access the code snippet for the selectMedia() API<\/a> from our docs.<\/p>\n<p>Here&#8217;s how the experience looks in a sample application:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-6083 size-full aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-camera.png\" alt=\"Image showing an app utilizing camera\/photo gallery capabilities\" width=\"608\" height=\"342\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-camera.png 608w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-camera-300x169.png 300w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/p>\n<h4>Record audio from the device microphone<\/h4>\n<p>You can also design powerful scenarios involving use of device microphone. We have enhanced our <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/mobile-camera-image-permissions?view=msteams-client-js-latest#media-capability-apis\">selectMedia() API<\/a> to support audio recording capability as well. This allows end users to record audio via the device microphone and preview the audio file before submitting. Relevant scenarios that this capability would enable include real-time note taking for field representatives\/agents that need to capture notes quickly on their device.<\/p>\n<p>You can <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/mobile-camera-image-permissions?view=msteams-client-js-latest#code-snippets\">access the code snippet for the selectMedia() API<\/a> from our docs.<\/p>\n<p>Here\u2019s how the experience looks in a sample application:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-6086 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-record-audio.png\" alt=\"Image showing an app utilizing microphone capabilities\" width=\"608\" height=\"342\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-record-audio.png 553w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-record-audio-300x169.png 300w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4>Fetch and show device location on map<\/h4>\n<p>For scenarios involving end users sharing their current location and picking a specific location on map, <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/location-capability\">we have introduced getLocation() API<\/a> in Teams JavaScript client SDK. Furthermore, showLocation() API could be leveraged to open location coordinates in native location supporting applications.<\/p>\n<p>You can <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/location-capability?view=msteams-client-js-latest#code-snippets\">access the code snippet for the getLocation() API and showLocation() API<\/a> from our docs.<\/p>\n<p>Here\u2019s how the experience looks in a sample application:<\/p>\n<p><em><img decoding=\"async\" class=\"wp-image-6084 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-fetch-and-show-location-300x191.png\" alt=\"Image showing an app utilizing location\/GPS from user\u2019s device\" width=\"608\" height=\"387\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-fetch-and-show-location-300x191.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-fetch-and-show-location-1024x651.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-fetch-and-show-location-768x488.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-fetch-and-show-location.png 1118w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/em><\/p>\n<p>&nbsp;<\/p>\n<h4>Utilize the device camera for QR code or barcode scanning<\/h4>\n<p>And lastly, for scenarios requiring users to scan a barcode to complete a workflow, <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/qr-barcode-scanner-capability?view=msteams-client-js-latest\">we have introduced scanBarCode() API<\/a> in Teams client SDK. Barcode is a method of representing data in a visual and machine-readable form and this capability lets a Teams webapp leverage scanner control powered by Microsoft Office Lens SDK to read it and share the details back with the underlying application. These can light up scenarios that eliminate the arduous and manual components of some activities.<\/p>\n<p>You can <a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/qr-barcode-scanner-capability?view=msteams-client-js-latest#code-snippet\">access the code snippet for the scanBarCode() API<\/a> from our docs.<\/p>\n<p>Here\u2019s how the experience looks in a sample application:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-6085 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-QR-scanning-1024x661.png\" alt=\"Image showing an app QR code scanner from user\u2019s device\" width=\"607\" height=\"392\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-QR-scanning-1024x661.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-QR-scanning-300x194.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-QR-scanning-768x496.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/Teams-device-QR-scanning.png 1114w\" sizes=\"(max-width: 607px) 100vw, 607px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>To see these capabilities in action, view this example app that we\u2019ve built using camera, microphone, and location:<\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><em><img decoding=\"async\" class=\"wp-image-6082 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/SelectMediaGIF_v2.gif\" alt=\"GIF showing an app utilizing camera, microphone, location capabilities\" width=\"300\" height=\"533\" \/><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>And here\u2019s an example of an app using QR code scanner capabilities:<\/p>\n<p><em><img decoding=\"async\" class=\"wp-image-6081 size-full aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/03\/QR-Code-Scanner-GIF.gif\" alt=\"\" width=\"320\" height=\"660\" \/><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>All of the above capabilities are now generally available with the release of <a href=\"https:\/\/docs.microsoft.com\/en-us\/javascript\/api\/overview\/msteams-client?view=msteams-client-js-latest&amp;preserve-view=true\">version 1.9 of Teams JavaScript client SDK<\/a> \u2013 and we have more new features coming soon that will integrate \u2018People Picker\u2019 high value components, video capture\/player capabilities, and image capture\/location capabilities (desktop).<\/p>\n<p>Now that you\u2019ve learned about these four great device capabilities, you can start using these APIs to enable innovative scenarios in your Teams app for the mobile workforce! We\u2019ve provided our developer documentation and SDK reference documentation pages below for easy access to learn more on how to integrate these in your webapps.<\/p>\n<p>Happy coding!<\/p>\n<p>Documentation links<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/device-capabilities-overview?view=msteams-client-js-latest\">Device capabilities &#8211; Overview<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/native-device-permissions?view=msteams-client-js-latest&amp;tabs=desktop\">Request device permissions<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/mobile-camera-image-permissions?view=msteams-client-js-latest\">Media APIs (camera, photo gallery, mic)<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/location-capability\">Integrate location capabilities<\/a>.<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/microsoftteams\/platform\/concepts\/device-capabilities\/qr-barcode-scanner-capability?view=msteams-client-js-latest\">QR\/Bar code scanner APIs<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The enhanced Microsoft Teams platform allows partners to integrate device capabilities, such as camera, QR or barcode scanner, photo gallery, microphone, and location with their web apps. <\/p>\n","protected":false},"author":69074,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[128],"tags":[],"class_list":["post-6079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-teams"],"acf":[],"blog_post_summary":"<p>The enhanced Microsoft Teams platform allows partners to integrate device capabilities, such as camera, QR or barcode scanner, photo gallery, microphone, and location with their web apps. <\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/6079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69074"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=6079"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/6079\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=6079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=6079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=6079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}