Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
davidortinau avatar

Maui Local Notifications

  • 33 installs
  • 163 repo stars
  • Updated July 6, 2026
  • davidortinau/maui-skills

Adds local notifications to .NET MAUI apps on Android, iOS, and Mac Catalyst, covering channels, permissions, scheduling, and foreground/background handling.

About

Guides adding local notifications to .NET MAUI apps on Android, iOS and Mac Catalyst, covering channels, permissions, scheduling and foreground/background handling. A developer uses it when scheduling on-device notifications in a MAUI app.

  • Notification channels, permissions, and scheduling
  • Foreground and background handling across platforms

Maui Local Notifications by the numbers

  • 33 all-time installs (skills.sh)
  • Ranked #648 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davidortinau/maui-skills --skill maui-local-notifications

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs33
repo stars163
Last updatedJuly 6, 2026
Repositorydavidortinau/maui-skills

What it does

Adds local notifications to .NET MAUI apps on Android, iOS, and Mac Catalyst, covering channels, permissions, scheduling, and foreground/background handling.

Files

SKILL.mdMarkdownGitHub ↗

.NET MAUI Local Notifications

Implementation overview

1. Define cross-platform INotificationManagerService interface and event args 2. Implement Android notification service (channel, AlarmManager, BroadcastReceiver) 3. Implement iOS/Mac Catalyst notification service (UNUserNotificationCenter) 4. Register platform implementations via DI 5. Configure platform permissions and MainActivity

See references/local-notifications-api.md for full implementation code.

Platform gotchas

Android

IssueFix
Notifications silently fail on API 33+Must request POST_NOTIFICATIONS runtime permission first
PendingIntent crash on Android 12+Must include PendingIntentFlags.Immutable for API 31+
Scheduled notifications lost on rebootAlarmManager does not survive device restart — re-schedule on boot via BOOT_COMPLETED receiver
No notification appearsChannel not created — required on API 26+ (Android 8.0)
Notification tap doesn't return to appLaunchMode = LaunchMode.SingleTop must be set on MainActivity
// ✅ Correct — API 31+ requires Immutable flag
var pendingIntentFlags = (Build.VERSION.SdkInt >= BuildVersionCodes.S)
    ? PendingIntentFlags.CancelCurrent | PendingIntentFlags.Immutable
    : PendingIntentFlags.CancelCurrent;

// ❌ Wrong — crashes on Android 12+
var pendingIntentFlags = PendingIntentFlags.CancelCurrent;

iOS / Mac Catalyst

IssueFix
No notification prompt appearsPermission already denied — user must re-enable in Settings
Foreground notifications don't showMust implement UNUserNotificationCenterDelegate and set Current.Delegate
Notification shows Alert not BannerUse UNNotificationPresentationOptions.Banner on iOS 14+
// ✅ iOS 14+ — use Banner
completionHandler(OperatingSystem.IsIOSVersionAtLeast(14)
    ? UNNotificationPresentationOptions.Banner
    : UNNotificationPresentationOptions.Alert);

// ❌ Always using Alert — deprecated on iOS 14+
completionHandler(UNNotificationPresentationOptions.Alert);

Windows

⚠️ Windows App SDK supports toast notifications but scheduled notifications are not yet supported. Immediate notifications work.

DI registration — platform-specific only

// ✅ Must use #if guards — there's no cross-platform implementation
#if ANDROID
    builder.Services.AddTransient<INotificationManagerService,
        Platforms.Android.NotificationManagerService>();
#elif IOS
    builder.Services.AddTransient<INotificationManagerService,
        Platforms.iOS.NotificationManagerService>();
#elif MACCATALYST
    builder.Services.AddTransient<INotificationManagerService,
        Platforms.MacCatalyst.NotificationManagerService>();
#endif

Common anti-patterns

// ❌ Sending without checking permission — silent failure on API 33+
notificationManager.SendNotification("Title", "Body");

// ✅ Request permission first
#if ANDROID
var status = await Permissions.RequestAsync<Platforms.Android.NotificationPermission>();
if (status != PermissionStatus.Granted) return;
#endif

// ❌ Updating UI directly from notification callback — cross-thread exception
notificationManager.NotificationReceived += (s, e) =>
    myLabel.Text = ((NotificationEventArgs)e).Title;

// ✅ Marshal to UI thread
notificationManager.NotificationReceived += (s, e) =>
    MainThread.BeginInvokeOnMainThread(() =>
        myLabel.Text = ((NotificationEventArgs)e).Title);

Decision framework

NeedApproach
Immediate notificationSendNotification(title, message) with null notifyTime
Scheduled reminderSendNotification(title, message, DateTime.Now.AddMinutes(30))
Persist across reboot (Android)Add BOOT_COMPLETED receiver to re-schedule alarms
Rich notifications (images, actions)Extend platform implementations with native APIs
Push notifications from serverUse a different pattern entirely (FCM/APNs)

Quick checklist

  • [ ] Cross-platform INotificationManagerService interface defined
  • [ ] Android: notification channel created (API 26+)
  • [ ] Android: POST_NOTIFICATIONS permission in manifest + runtime request (API 33+)
  • [ ] Android: PendingIntentFlags.Immutable used (API 31+)
  • [ ] Android: MainActivity has LaunchMode.SingleTop and handles OnNewIntent
  • [ ] iOS: UNUserNotificationCenterDelegate set for foreground display
  • [ ] iOS: Banner used instead of Alert on iOS 14+
  • [ ] DI registration uses #if platform guards
  • [ ] UI updates from notification callbacks use MainThread.BeginInvokeOnMainThread

Related skills

Mobile Developmentfrontendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.