Xamarin.Essentials 1.7 and introducing .NET MAUI Essentials

James Montemagno

Xamarin.Essentials has become a critical library for .NET developers building apps across iOS, Android, Tizen, macOS, and Windows since its original release over three years ago. Since then the library has been installed nearly 10 million times, has 79 contributors, has been stared 1,400 times on GitHub, and has been the foundation for developers around the globe to access native APIs. Today, I would like to share with you what is new in the latest version of Xamarin.Essentials 1.7, and talk about the future roadmap for the library as .NET Multi-platform App UI (MAUI) approaches this fall.

Xamarin.Essentials 1.7

This release of Xamarin.Essentials focuses on critical bug fixes and introduces enhancements to the Web Authenticator API.

Logo for Xamarin.Essentials

Web Authenticator

The Web Authenticator enables you to add authentication to your app and integrate with many providers using your own server backend powered by ASP.NET Core. There have been several fixes introduced for all platforms from the team and the community! Thank you!

Web authenticator overview of authentication from mobile to backend

We have also introduced a new API for private authentication sessions on iOS.

Private authentication session

iOS 13 introduced a new web browser API for developers to launch the authentication session as private. This enables developers to request that no shared cookies or browsing data is available between authentication sessions and will be a fresh login session each time. This is available through the new WebAuthenticatorOptions that was introduced in Xamarin.Essentials 1.7 for iOS.

var url = new Uri("https://mysite.com/mobileauth/Microsoft");
var callbackUrl = new Uri("myapp://")
var authResult = await WebAuthenticator.AuthenticateAsync(new WebAuthenticatorOptions
    {
        Url = url,
        CallbackUrl = callbackUrl,
        PrefersEphemeralWebBrowserSession = true
    });

.NET MAUI Essentials

.NET MAUI is the future of Xamarin.Forms and .NET MAUI Essentials is the future of Xamarin.Essentials. .NET MAUI Essentials is part of the .NET MAUI GitHub repo and has been under active development to seamlessly transition to .NET MAUI.

.NET MAUI Essentials is now directly integrated into .NET MAUI starting with .NET 6 Preview 6 and .NET MAUI Preview 6. When you create a new .NET MAUI application, it will use the new .NET MAUI workload and you will see <UseMaui>true</UseMaui> in the .csproj. With this enabled all of .NET MAUI Essentials comes into your project! All you need to do is add using Microsoft.Maui.Essentials; and all of the APIs you know and love are at your fingertips.

We know that there are developers today that will be updating their existing Xamarin.iOS and Xamarin.Android apps to .NET 6 without .NET MAUI and still want to leverage all of the APIs in Xamarin.Essentials. We have you covered as well as you can add <UsingMauiEssentials>true</UsingMauiEssentials> to your .NET 6 iOS and Android apps to bring in all of the latest APIs.

We are excited for this next chapter of Xamarin.Essentials with .NET MAUI Essentials and we hope you are too!

Sunsetting Xamarin.Essentials

Earlier this year we announced that we will be following the same schedule as Xamarin.Forms. This means that we will continue to service Xamarin.Essentials through November 2022 and accept pull requests fixing bugs and publishing new service releases. New features and APIs will only be added to .NET MAUI Essentials going forward and pull-requests are welcome!

Summary

Please let us know about your experiences using .NET MAUI Essentials in .NET MAUI Preview 6 to create new applications by engaging with us on GitHub at dotnet/maui.

For a look at what is coming in future releases, visit the .NET MAUI product roadmap.