NotifyApiMultiPlatform 1.0.0
dotnet add package NotifyApiMultiPlatform --version 1.0.0
NuGet\Install-Package NotifyApiMultiPlatform -Version 1.0.0
<PackageReference Include="NotifyApiMultiPlatform" Version="1.0.0" />
<PackageVersion Include="NotifyApiMultiPlatform" Version="1.0.0" />
<PackageReference Include="NotifyApiMultiPlatform" />
paket add NotifyApiMultiPlatform --version 1.0.0
#r "nuget: NotifyApiMultiPlatform, 1.0.0"
#:package NotifyApiMultiPlatform@1.0.0
#addin nuget:?package=NotifyApiMultiPlatform&version=1.0.0
#tool nuget:?package=NotifyApiMultiPlatform&version=1.0.0
MauiToastNotifyApi
Cross-platform toast/local notification helper for .NET MAUI and MAUI Blazor Hybrid apps. Ships a single API that lights up native notifications on Windows, Android, iOS, MacCatalyst and falls back to notify-send
or console output on desktop Linux.
✨ Features
- ✅ Single
Toast
API usable from .NET MAUI, MAUI Blazor Hybrid, and classic Windows apps - ✅ Windows implementation keeps CommunityToolkit-powered hero images, buttons, payload + activation callbacks
- ✅ Android uses native notification channels & icons (auto creates channel on first init)
- ✅ iOS/MacCatalyst schedule
UNUserNotificationCenter
alerts and surface activation callbacks - ✅ Linux/Generic .NET hosts fall back to
notify-send
(if present) or console log - ✅ Helpers for
Toast.Info/Success/Warning/Error
presets and sharedToastOptions
📦 Install
dotnet add package MauiToastNotifyApi
Targets
net8.0-windows10.0.19041.0
,net8.0-android
,net8.0-ios
,net8.0-maccatalyst
, andnet8.0
(fallback/Linux).
🚀 Quick Start (.NET MAUI)
Call Toast.Initialize
once after the MAUI app is built (for Windows the AppUserModelID doubles as the notification channel id on Android):
// MauiProgram.cs
using WindowsToastNotifyApi; // Namespace kept for backwards compatibility
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts => fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"));
var app = builder.Build();
Toast.Initialize(
appId: "com.company.myapp", // Windows AppUserModelID / Android channel id
displayName: "My App",
iconPath: null); // Optional Windows .ico/.png absolute path
return app;
}
Trigger notifications anywhere after initialization:
// e.g. inside a Page/ViewModel command
Toast.Success("Backup complete", "All files synced to the cloud.");
Toast.Show("Deploy ready", "Promote to production?",
new ToastOptions
{
PrimaryButton = ("Deploy now", "deploy"), // Windows buttons only
SecondaryButton = ("Later", "later"),
Payload = new Dictionary<string, string> { ["pipelineId"] = "a1b2c3" }
});
For Win32 console/WPF/WinForms the usage stays unchanged.
🔄 Activation Callback
Toast.Activated += args =>
{
Console.WriteLine($"Arguments: {args.Arguments}");
foreach (var kv in args.Payload)
Console.WriteLine($"{kv.Key}={kv.Value}");
};
Platform | Activation Support |
---|---|
Windows | ✅ via CommunityToolkit + Start Menu shortcut |
iOS / MacCatalyst | ✅ via UNUserNotificationCenter response |
Android | ⚠️ Launches the app; explicit callbacks TBD |
Linux / net8.0 | ❌ (console/log only) |
🧰 ToastOptions Cheat Sheet
Option | Windows | Android | iOS/Mac | Linux |
---|---|---|---|---|
HeroImagePath |
✅ | ❌ | ❌ | ❌ |
AppLogoOverridePath |
✅ | ❌ | ❌ | ❌ |
Silent |
⚠️ (ignored on Toolkit 7.1.2) | ✅ | ✅ | ❌ |
Duration |
✅ | ❌ | ❌ | ❌ |
Primary/SecondaryButton |
✅ | ❌ | ❌ | ❌ |
Payload |
✅ | ✅ (intent extras) | ✅ | ❌ |
Options that are not supported on a platform are safely ignored.
📝 Platform Notes
- Windows: still creates an AppUserModelID shortcut under Start → Programs if missing. Buttons & activation payloads work as before.
- Android: uses the MAUI
Platform.AppContext
; make sureMauiProgram.CreateMauiApp
runs before callingToast.Initialize
. Notifications reuse the application icon. - iOS/MacCatalyst: requests notification permissions on first initialization and hooks
UNUserNotificationCenter.Current.Delegate
to raiseToast.Activated
. - Linux / net8.0: tries to execute
notify-send
. If the binary is not available it falls back toConsole.WriteLine
.
🛠 Development
# Windows only shortcut creation still requires an interactive user
# Build the Windows target (other targets require the matching workloads)
dotnet build WindowsToastNotifyApi/WindowsToastNotifyApi.csproj -f net8.0-windows10.0.19041.0
Android/iOS/MacCatalyst builds require the corresponding .NET MAUI workloads to be installed on your machine.
📄 License
MIT © 2025 Ben Sowieja
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios18.0 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst18.0 is compatible. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
-
net8.0-android34.0
- No dependencies.
-
net8.0-ios18.0
- No dependencies.
-
net8.0-maccatalyst18.0
- No dependencies.
-
net8.0-windows10.0.19041
- CommunityToolkit.WinUI.Notifications (>= 7.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 108 | 9/24/2025 |