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.
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!
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.
Hi,Can we convert xamarin forms and Essentials version – SDK 11.2.2.1 controls to Maui.Please let us know if there is any way to do it.
I wrote a simple Maui Blazor app and am using Microsoft.Maui.Essentials. The app crashs with a "Window Not Found" exception when I call:
<code>
I'm using the Android emulator and in the startup in the Configure() call, I initialize Platform:
<code>
The output following the call is:
[monodroid] MonodroidRuntime::monodroid_pinvoke_override ("java-interop", "java_interop_jnienv_get_object_field")
[monodroid] Found java-interop@java_interop_jnienv_get_object_field in internal p/invoke map (0xd329a800)
[monodroid] MonodroidRuntime::monodroid_pinvoke_override ("java-interop", "java_interop_jnienv_get_object_field")
[monodroid] Found java-interop@java_interop_jnienv_get_object_field in internal p/invoke map (0xd329a800)
[monodroid] MonodroidRuntime::monodroid_pinvoke_override ("java-interop", "java_interop_jnienv_get_object_field")
[monodroid] Found java-interop@java_interop_jnienv_get_object_field...
Glad to see things are moving forward! Already trying to migrate my app to MAUI.
You have a typo there. Correct tag is instead of .
Also I have a project that targets (without ) and build with fails with
<code>
It expects in target framework, but this is a platform-agnostic library that is later included in project that targets android.
Here're some things that it uses from Xamarin/MAUI nugets that are not platform specific:
-...
Hi James, indeed an awesome library. I think the most used class in Essentials must be Preferences .
Please make preferences also work cross platform in Blazor !!! If I use Preferences.Set(“my_key”, “my_value”) in blazor it does not work so I end rewriting huge amount of code for Blazor.
Why did you call it Maui essentials? It has nothing to do with UI?? It should be called Microsoft.Essentials or something like that. We are a lot of people who don’t want MAUI and just want android and iOS with .net 6.