plugins/shiny-extensions/skills/shiny-maui-hosting/SKILL.md
Generate and configure Shiny MAUI Hosting for .NET - modular MAUI app configuration with IMauiModule, static Host.Services access, and platform lifecycle hooks
npx skillsauth add shinyorg/skills shiny-maui-hostingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in Shiny Extensions MAUI Hosting, a .NET library providing modular MAUI app configuration via IMauiModule with a static service provider accessor and platform lifecycle hooks.
Invoke this skill when the user wants to:
IMauiModuleIAppForeground, IAppBackground, etc.)Host.ServicesDocumentation: https://shinylib.net/extensions/mauihost/
Repository: https://github.com/shinyorg/Shiny.Extensions
Package: Shiny.Extensions.MauiHosting
Namespace: Shiny
public interface IMauiModule
{
void Add(MauiAppBuilder builder); // Register services
void Use(IPlatformApplication app); // Post-build initialization (do NOT block)
}
Each module implements IMauiModule with two methods:
Add(MauiAppBuilder builder) — register services, configure the builder. Runs before the app is built.Use(IPlatformApplication app) — post-build initialization. Host.Services is available here. Do NOT block — runs on the main thread.public class AnalyticsModule : IMauiModule
{
public void Add(MauiAppBuilder builder)
{
builder.Services.AddSingleton<IAnalytics, AppCenterAnalytics>();
}
public void Use(IPlatformApplication app)
{
var analytics = Host.Services.GetRequiredService<IAnalytics>();
analytics.TrackEvent("AppStarted");
}
}
using Shiny;
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.AddInfrastructureModules(new AnalyticsModule(), new NetworkModule());
return builder.Build();
After initialization, Host.Services provides access to the service provider from anywhere:
var service = Host.Services.GetRequiredService<IMyService>();
:::caution
Host.Services throws InvalidOperationException if accessed before initialization. Host.Lifecycle is internal — lifecycle dispatch is handled automatically.
:::
Register services that implement lifecycle interfaces to respond to platform events. The ILifecycleExecutor dispatches events to all registered handlers automatically.
[Singleton]
public class AppLifecycleHandler : IAppForeground, IAppBackground
{
public void OnForeground() { /* app came to foreground */ }
public void OnBackground() { /* app went to background */ }
}
| Interface | Purpose |
|-----------|---------|
| IAppForeground | App entering foreground |
| IAppBackground | App entering background |
[Singleton]
public class DeepLinkHandler : IContinueActivity
{
public bool Handle(NSUserActivity activity)
{
// Handle universal links, handoff, etc.
return true;
}
}
| Interface | Purpose |
|-----------|---------|
| IContinueActivity | Universal links, handoff |
| IOnFinishedLaunching | App finished launching |
[Singleton]
public class PermissionHandler : IOnActivityRequestPermissionsResult
{
public void Handle(Activity activity, int requestCode, string[] permissions, Permission[] grantResults)
{
// Handle permission results
}
}
| Interface | Purpose |
|-----------|---------|
| IOnApplicationCreated | Application creation |
| IOnActivityOnCreate | Activity creation |
| IOnActivityRequestPermissionsResult | Permission request results |
| IOnActivityNewIntent | New intent received |
| IOnActivityResult | Activity result callback |
public static class MauiExtensions
{
// Register MAUI modules - calls Add() on each, sets up Host initialization
public static MauiAppBuilder AddInfrastructureModules(
this MauiAppBuilder builder,
params IEnumerable<IMauiModule> modules);
}
public class Host : IMauiInitializeService
{
public static IServiceProvider Services { get; }
}
Add() for service registration and Use() for post-build initializationUse() - it runs on the main thread during app startupHost.Services to resolve services after the app is builtIAppForeground, IAppBackground, etc.) via DI for platform eventsTask.Run or similarHost.Services only where DI is unavailable[Singleton] attributes on lifecycle handler classesdevops
Guide for implementing push notifications in .NET MAUI apps using Shiny.Push (native FCM/APNs) and Shiny.Push.AzureNotificationHubs
tools
Cross-platform local notification management for .NET MAUI apps using Shiny, supporting scheduled, repeating, and geofence-triggered notifications with channels, badges, and interactive actions.
tools
GPS tracking, geofence monitoring, and motion activity recognition for .NET MAUI, iOS, and Android using Shiny.Locations
data-ai
Background job scheduling and execution for .NET MAUI (iOS/Android native OS schedulers) and in-process jobs for plain .NET, Linux, macOS, and Blazor WASM using Shiny.Jobs