{"id":48063,"date":"2020-10-07T11:55:16","date_gmt":"2020-10-07T18:55:16","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/xamarin\/?p=48063"},"modified":"2020-10-08T09:00:06","modified_gmt":"2020-10-08T16:00:06","slug":"xamarin-essentials-1-6-preview","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/xamarin-essentials-1-6-preview\/","title":{"rendered":"Xamarin.Essentials 1.6 preview: macOS, media, and more!"},"content":{"rendered":"<p>Xamarin.Essentials has been a staple for developers building iOS, Android, and Windows apps with Xamarin and .NET since it was first released last year. Now, we are introducing Xamarin.Essentials 1.6, which adds new APIs including <code>MediaPicker<\/code>, <code>AppActions<\/code>, <code>Contacts<\/code>, and more. Not to mention that this release also features official support for macOS! This means that Xamarin.Essentials now offers over 50 native integrations with support for 7 different operating systems. All from a single library that is optimized for performance, linker safe, and production ready. Here is a highlight reel of all the new features:<\/p>\n<p><center>\n  <div style=\"width: 272px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-48063-1\" width=\"272\" height=\"496\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/Xamarin.Essentials-1.6.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/Xamarin.Essentials-1.6.mp4\">https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/Xamarin.Essentials-1.6.mp4<\/a><\/video><\/div>\n<\/center><\/p>\n<h2>Welcome macOS<\/h2>\n<p>Since the first release of Xamarin.Essentials the team and community have been continuously working to add more platforms to fit developer&#8217;s needs. After adding tvOS, watchOS, and Tizen support the next natural step was first class support for macOS to compliment the UWP desktop support. I am pleased to announce most APIs are now supported for macOS 10.12.6 (Sierra) and higher! Take a look at the update <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/platform-feature-support?WT.mc_id=docs-blog-jamont\">platform support<\/a> page to see all of the APIs that you can leverage on your macOS apps.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/macos-1024x519.png\" alt=\"List of all supported platforms in Xamarin.Essentials\" width=\"640\" height=\"324\" class=\"aligncenter size-large wp-image-48065\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/macos-1024x519.png 1024w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/macos-300x152.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/macos-768x389.png 768w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/macos.png 1201w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2><a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/media-picker?WT.mc_id=docs-blog-jamont\">MediaPicker<\/a> and <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/file-picker?WT.mc_id=docs-blog-jamont\">FilePicker<\/a><\/h2>\n<p>The time has finally come for brand new media capabilities in Xamarin.Essentials. These new APIs enable you to easily access device features such as picking a file from the system, selecting photos or videos, or having your user take a photo or video with the camera.<\/p>\n<pre><code class=\"csharp\">async Task TakePhotoAsync()\n{\n    try\n    {\n        var photo = await MediaPicker.CapturePhotoAsync();\n        await LoadPhotoAsync(photo);\n        Console.WriteLine($\"CapturePhotoAsync COMPLETED: {PhotoPath}\");\n    }\n    catch (Exception ex)\n    {\n        Console.WriteLine($\"CapturePhotoAsync THREW: {ex.Message}\");\n    }\n}\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/MediaPicker-1.gif\" alt=\"Animation of picking a photo or taking a photo\" width=\"290\" height=\"528\" class=\"aligncenter size-full wp-image-48072\" \/><\/p>\n<h2><a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/app-actions?WT.mc_id=docs-blog-jamont\">App Actions<\/a><\/h2>\n<p>App actions, shortcuts, and jump lists have all been simplified across iOS, Android, and UWP with this new API. You can now manually create and react to actions when the user selects them from the app icon.<\/p>\n<pre><code class=\"csharp\">try\n{\n    await AppActions.SetAsync(\n        new AppAction(\"app_info\", \"App Info\", icon: \"app_info_action_icon\"),\n        new AppAction(\"battery_info\", \"Battery Info\"));\n}\ncatch (FeatureNotSupportedException ex)\n{\n    Debug.WriteLine(\"App Actions not supported\");\n}\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/appactions.png\" alt=\"mage of iOS, Android, and UWP with a jumplist of actions\" width=\"975\" height=\"235\" class=\"aligncenter size-full wp-image-48067\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/appactions.png 975w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/appactions-300x72.png 300w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/appactions-768x185.png 768w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/p>\n<h2><a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/contacts?WT.mc_id=docs-blog-jamont\">Contacts<\/a><\/h2>\n<p>Does your app need the ability to get contact information? The brand-new Contacts API has you covered with a single line of code to launch a contact picker to gather information:<\/p>\n<pre><code class=\"csharp\">try\n{\n    var contact = await Contacts.PickContactAsync();\n\n    if(contact == null)\n        return;\n\n    var name = contact.Name;\n    var contactType = contact.ContactType; \/\/ Unknown, Personal, Work\n    var numbers = contact.Numbers; \/\/ List of phone numbers\n    var emails = contact.Emails; \/\/ List of email addresses \n\n}\ncatch (Exception ex)\n{\n    \/\/ Handle exception here.\n}\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/09\/Contacts-1.gif\" alt=\"Animation showing picking different contacts\" width=\"290\" height=\"528\" class=\"aligncenter size-full wp-image-48073\" \/><\/p>\n<h2>So Much More<\/h2>\n<p>That is just the start of brand-new features in Xamarin.Essentials 1.6. When you install the latest update, you will also find new APIs including <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/screenshot?WT.mc_id=docs-blog-jamont\">Screenshot<\/a>, <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/haptic-feedback?WT.mc_id=docs-blog-jamont\">Haptic Feedback<\/a>, and an expanded <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/permissions?WT.mc_id=docs-blog-jamont\">Permissions<\/a> API. Additionally, there has been tweaks and optimizations to existing features and of course some bug fixes.<\/p>\n<h2>Built with the Community<\/h2>\n<p>One of the most exciting parts of working on Xamarin.Essentials is seeing the amazing community contributions. The additions this month included exciting new large new APIs, small tweaks, and plenty of bug fixes. Thank you to everyone that has filed an issue, filed a feature request, reviewed code, or sent a full pull request down.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/sung-su\">sung-su.kim<\/a> &#8211; Tizen FilePicker<\/li>\n<li><a href=\"https:\/\/github.com\/IlGalvo\">Andrea Galvani<\/a> &#8211; UWP Authenticator Fixes, <\/li>\n<li><a href=\"https:\/\/github.com\/pictos\">Pedro Jesus<\/a> &#8211; Contacts, Color.ToHsv\/FromHsva<\/li>\n<li><a href=\"https:\/\/github.com\/dimonovdd\">Dimov Dima<\/a> &#8211; HapticFeedback API<\/li>\n<li><a href=\"https:\/\/github.com\/dogukandemir\">Dogukan Demir<\/a> &#8211; Android O Fixes in Permissions<\/li>\n<li><a href=\"https:\/\/github.com\/sreerajPR\">Sreeraj P R<\/a> &#8211; Audio fixes on Text-to-Speech<\/li>\n<li><a href=\"https:\/\/github.com\/MKuckert\">Martin Kuckert<\/a> &#8211; iOS Web Authenticator Fixes<\/li>\n<li><a href=\"https:\/\/github.com\/solomonfried\">solomonfried<\/a> &#8211; WebAuthenticator Email<\/li>\n<li><a href=\"https:\/\/github.com\/vividos\">vividos<\/a> &#8211; FilePicker API<\/li>\n<li><a href=\"https:\/\/github.com\/janusw\">Janus Weil<\/a> &#8211; Location class fixes, AltitudeReferenceSystem addition<\/li>\n<li><a href=\"https:\/\/github.com\/edsnider\">Ed Snider<\/a> &#8211; App Actions <\/li>\n<\/ul>\n<h2>Learn More<\/h2>\n<p>Be sure to read the full <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials\/release-notes\/1.6\">release notes<\/a> and the <a href=\"https:\/\/docs.microsoft.com\/xamarin\/essentials?WT.mc_id=docs-blog-jamont\">updated documentation<\/a> to learn more about each of the new features.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Announcing the preview for Xamarin.Essentials 1.6 that introduces official support for macOS and exciting features including a file &#038; media picker, app actions, screenshots, and much more.<\/p>\n","protected":false},"author":544,"featured_media":48065,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[556,303,362,1,291,367],"tags":[9171,9170,9172,27,24],"class_list":["post-48063","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-integrations","category-ios","category-macos","category-xamarin","category-xamarin-platform","category-xamarin-forms","tag-camera","tag-media","tag-screenshot","tag-xamarin","tag-xamarin-essentials"],"acf":[],"blog_post_summary":"<p>Announcing the preview for Xamarin.Essentials 1.6 that introduces official support for macOS and exciting features including a file &#038; media picker, app actions, screenshots, and much more.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/48063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/544"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=48063"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/48063\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/48065"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=48063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=48063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=48063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}