October 7th, 2020

Xamarin.Essentials 1.6 preview: macOS, media, and more!

James Montemagno
Principal Manager, Tech PM

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 MediaPicker, AppActions, Contacts, 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:

Welcome macOS

Since the first release of Xamarin.Essentials the team and community have been continuously working to add more platforms to fit developer’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 platform support page to see all of the APIs that you can leverage on your macOS apps.

List of all supported platforms in Xamarin.Essentials

MediaPicker and FilePicker

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.

async Task TakePhotoAsync()
{
    try
    {
        var photo = await MediaPicker.CapturePhotoAsync();
        await LoadPhotoAsync(photo);
        Console.WriteLine($"CapturePhotoAsync COMPLETED: {PhotoPath}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"CapturePhotoAsync THREW: {ex.Message}");
    }
}

Animation of picking a photo or taking a photo

App Actions

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.

try
{
    await AppActions.SetAsync(
        new AppAction("app_info", "App Info", icon: "app_info_action_icon"),
        new AppAction("battery_info", "Battery Info"));
}
catch (FeatureNotSupportedException ex)
{
    Debug.WriteLine("App Actions not supported");
}

mage of iOS, Android, and UWP with a jumplist of actions

Contacts

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:

try
{
    var contact = await Contacts.PickContactAsync();

    if(contact == null)
        return;

    var name = contact.Name;
    var contactType = contact.ContactType; // Unknown, Personal, Work
    var numbers = contact.Numbers; // List of phone numbers
    var emails = contact.Emails; // List of email addresses 

}
catch (Exception ex)
{
    // Handle exception here.
}

Animation showing picking different contacts

So Much More

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 Screenshot, Haptic Feedback, and an expanded Permissions API. Additionally, there has been tweaks and optimizations to existing features and of course some bug fixes.

Built with the Community

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.

Learn More

Be sure to read the full release notes and the updated documentation to learn more about each of the new features.

Author

James Montemagno
Principal Manager, Tech PM

James Montemagno is a Principal Lead Program Manager for Developer Community at Microsoft. He has been a .NET developer since 2005, working in a wide range of industries including game development, printer software, and web services. Prior to becoming a Principal Program Manager, James was a professional mobile developer and has now been crafting apps since 2011 with Xamarin. In his spare time, he is most likely cycling around Seattle or guzzling gallons of coffee at a local coffee shop. He ...

More about author

18 comments

Discussion is closed. Login to edit/delete existing comments.

  • Vincent van Rooijen

    Hi James,

    I updated to the latest Visual Studio 2019: 4.7.03190, but I cannot install Essentials 1.6 I can only install 1.5.XXX

  • Tom Joney

    Amazing man, Make sure to fix them bugs though. Can’t wait for camera/video functionality.

  • Tony Henrique

    Some useful new features!

  • Fred

    I would love to see Linux ❤ support!

  • Johan Mulder

    Hi James,

    The media / file picker can it select files / media from Onedrive or Google Drive as you would find in native apps ?

  • Imran Shaik

    How would MediaPicker be any different to say your own MediaPlugin/CrossMedia? Officially supported? MediaPicker does seem to have less functionality to compared to MediaPlugin.

    • James MontemagnoMicrosoft employee Author

      This new functionality will deprecate my plugin once it goes GA. This is similar to how some of my others as Essentials is super optimized, has official support, and is in the box. Most of the same functionality that my plugin has is in this initial release 🙂

      • MOHAMED CISSE

        When the GA?

  • Blake Nong

    Hi James,

    Are we able to select multiple photos?

      • anonymous

        this comment has been deleted.

      • MOHAMED CISSE

        Hi James,
        Is it ready for production ?

      • MOHAMED CISSE

        When will GA be available ?

  • Sebastian Schlund

    Very interesting new options.
    Now i’m only missing a Sound Option and a Toast Option
    P.s. The App Action Link is dead.

  • David Ramel

    Unfortunate typo: ” I am pleased to announce most APIs are no supported for macOS 10.12.6 (Sierra) and higher!”