Telerik blogs

Welcome to the Sands of MAUI—newsletter-style issues dedicated to bringing together latest .NET MAUI content relevant to developers.

A particle of sand—tiny and innocuous. But put a lot of sand particles together and we have something big—a force to reckon with. It is the smallest grains of sand that often add up to form massive beaches, dunes and deserts.

Most .NET developers are excited with .NET Multi-platform App UI (MAUI)—the evolution of modern .NET cross-platform developer experience. Going forward, developers should have much more confidence in the technology stack and tools as .NET MAUI empowers native cross-platform solutions on both mobile and desktop.

While it may take a long flight to reach the sands of MAUI island, developer excitement around .NET MAUI is quite palpable in all the shared content. Like the grains of sand, every piece of news/article/documentation/video/tutorial/livestream contributes towards developer knowledge in .NET MAUI and we grow a community/ecosystem willing to learn & help.

Sands of MAUI is a humble attempt to collect all the .NET MAUI awesomeness in one place. Here's what is noteworthy for the week of October 31, 2022:

Media Element Preview

Need to work with media in your .NET MAUI app? The ubiquitous need for a consistent media player in .NET MAUI apps may soon be provided out of the box with the .NET MAUI Community Toolkit. The MediaElement component has been in the works and Gerald Versluis produced a video with early preview bits—how to play videos in .NET MAUI apps with MediaElement.

What can .NET MAUI developers do with the MediaElement component in .NET MAUI Community Toolkit? In short, everything—everything one expects from a full featured media player component. The MediaElement component is poised to be able to play local or remote content and sport UI to set speed/position/volume/looping and more. The goal is to make things consistent across mobile/desktop on iOS, Android, Windows and MacOS, although implementations may differ per platform—MediaElement is reusing ExoPlayer on Android and AVPlayer on iOS.

Gerald did a walkthrough of the sample app for .NET MAUI Community Toolkit, which now houses demos for the MediaElement—it is nice to see a proper video playback from an URL with all the bells and whistles. Scheduled for release around .NET 7 timeframe, MediaElement will have its own NuGet package so as to avoid unnecessary dependencies with the .NET MAUI Community Toolkit.

The developer community sure appreciates all the work going into the MediaElement—this would make working with most media a breeze for .NET MAUI apps.

Platform APIs with .NET MAUI

Mobile phones and tablets are meant to keep people connected to whatever matters the most to them. And some of the most common means of modern day communication are Phone calls, Text messages and Emails. Thankfully, developers building .NET MAUI apps do not have to rediscover the wheels of communication—cross-platform abstractions are built into .NET MAUI.

Leomaris Reyes wrote up a comprehensive article on how to do Email, SMS or Phone call integration from .NET MAUI apps.

Leomaris starts with the basics—core communications need settings and permissions that need to be set up on iOS, Android and Windows. Once configurations are in place, the good news is .NET MAUI has easy cross-platform abstractions in place—all wrapped up inside the Microsoft.Maui.ApplicationModel.Communication namespace.

Leomaris walks through how .NET MAUI developers can invoke the Phone dialers, send SMS messages or compose Emails—all with detailed explanations of the corresponding APIs. Platform integration of communication services—done and done in .NET MAUI.

MacOS Update

Developers on MacOS have a shiny new OS update. After being announced at WWDC in June, the next version of MacOS is now being released in October—namely MacOS 13 Ventura. With updates throughout the OS, developers can enjoy better productivity, device continuity and easier context switching. However, as with any OS update, it does beg the question for developers: Do all the things work with latest development technology stacks?

For .NET MAUI developers on MacOS, the hesitation to jump on to a new OS update can be attributed to many reasons—iOS dependencies, XCode version, MacCatalyst runtime, Visual Studio for Mac Preview bits and more. Brandon Minnick is here to the rescue, being bold enough to be amongst the first to update to MacOS Ventura.

Thankfully, all things work as expected for .NET MAUI and Xamarin bits—this includes platforms, tooling and deployments. Sure there are little roadblocks, but most other developers who have upgraded agree with Brandon—everything seems ok with .NET MAUI on MacOS Ventura, and this is great news to move things forward.

Protected APIs from .NET MAUI

Many .NET MAUI apps may offer value to users who are authenticated and authorized to access content. Authentication and Authorization are amongst the most common things native apps do, and as the saying goes, security may be best left to professionals who know what they're doing. Auth0 can help. Outside of the app itself, there may be services/APIs in the backend that are protected from unauthorized access.

Andrea Chiarelli wrote up a detailed article on how to call protected APIs from a .NET MAUI app.

Andrea provides the entire source code for a walkthrough—a sample .NET MAUI app paired with a sample protected ASP.NET Core Web API project. The .NET MAUI app has to authenticate users and the ASP.NET Core Web API has protected endpoints—both done through Auth0 integration. There is some configuration as both apps are registered with the Auth0 dashboard and credentials need to be set right as the .NET MAUI/Web API apps bootstrap themselves.

The workflow to invoke a protected API endpoint from the app is not difficult to understand—the .NET MAUI app needs to authenticate the user and send along the verified access token from Auth0 down to the API call. Implementations take a bit of code, but this is to be done once, and Andrea has detailed writeup with code explanations every step of the way—along with best practices for API security.

App Center Distribution with .NET MAUI

Visual Studio App Center is a collection of common mobile development and cloud integration services, such as builds, CI/CD pipelines, analytics, automated UI testing and app distribution. App Center is meant for mobile/desktop apps written in variety of technology stacks and has been popular among Xamarin developers, but support for .NET MAUI is slowly catching up. App Center Diagnostics and Analytics already work for .NET MAUI, but Andreas Nesheim wrote up what's next—.NET MAUI App Distribution with App Center.

Andreas starts with the basics of how to register apps in App Center—since portal has not been updated yet for .NET MAUI, developers have to choose the nearest platform equivalents for iOS and Android. .NET MAUI apps for mobile/desktop can be headed to the respective App Stores, and if so, should definitely be beta tested in a smaller group.

Alternatively, .NET MAUI apps can be distributed internally within an enterprise, with authorized access control. App Center can help either way. At the simplest, developers can upload pre-built .aab/.ipa app bundles to the App Center dashboard. What is more realistic is to include App Center distribution as a part of a build pipeline—Andreas explains the process in steps for Azure DevOps.

That's it for now.

We'll see you next week with more awesome content relevant to .NET MAUI.

Cheers, developers!


SamBasu
About the Author

Sam Basu

Sam Basu is a technologist, author, speaker, Microsoft MVP, gadget-lover and Progress Developer Advocate for Telerik products. With a long developer background, he now spends much of his time advocating modern web/mobile/cloud development platforms on Microsoft/Telerik technology stacks. His spare times call for travel, fast cars, cricket and culinary adventures with the family. You can find him on the internet.

Related Posts

Comments

Comments are disabled in preview mode.