Using Local Notifications in a Napacitor App
Platforms: Android, iOS, Mac Catalyst, Windows, Web
Local notifications are scheduled by the app on the device and displayed by the operating system — no server or push channel required. They suit reminders, calendars, and to-do scenarios. This guide covers how to use the @napacitor/local-notification plugin to send immediate or timed notifications, request permissions, handle tap callbacks, and what differs per platform.
Installation
npm install @napacitor/local-notification
npx nap sync
nap sync wires the plugin's C# project into the MAUI host (napacitor.build.props and napacitor.pluginrefs.g.cs are regenerated) and merges permissions declared via [assembly: UsesPermission] into the host AndroidManifest.xml.
Requesting Permissions
import { LocalNotification } from '@napacitor/local-notification';
const { granted } = await LocalNotification.requestPermission();
Platform behavior:
- Android: Android 13 (API 33)+ requires the
POST_NOTIFICATIONSruntime permission;requestPermission()shows the system dialog. The permission is already merged into the host manifest via the plugin's[assembly: UsesPermission], so no manual declaration is needed. Older versions are always granted. - iOS / Mac Catalyst:
requestPermission()triggers the system authorization dialog (Alert / Sound / Badge). - Windows: No runtime permission request; visibility is governed by the system Notification Settings.
requestPermission()always returns granted. - Web: Uses the browser Notification API; always granted.
Sending Immediate Notifications
const { notifications } = await LocalNotification.schedule({
notifications: [{ title: 'Reminder', body: 'Time to drink water', id: 1 }],
});
// { notifications: [{ id: 1 }] }
id is used for canceling and matching tap callbacks later; it is auto-generated when omitted. The result contains the final id of each notification. title / body are required.
Scheduling Timed Notifications
Add an ISO 8601 at value to schedule a notification for a future time:
await LocalNotification.schedule({
notifications: [{ title: 'Meeting', body: 'Meeting at 15:00', id: 2, at: '2026-11-03T15:00:00Z' }],
});
Platform implementations:
- Android:
AlarmManager(RTC_WAKEUP) +BroadcastReceiver; schedules are persisted toPreferencesand restored after device reboot via aRECEIVE_BOOT_COMPLETEDbroadcast (only non-expired ones). - iOS / Mac Catalyst:
UNCalendarNotificationTrigger; the system persists schedules, nothing to handle on reboot. - Web:
setTimeout; not fired once the page is closed. - Windows: the Windows App SDK does not yet support scheduled notifications; a non-null
atthrowsNOT_IMPLEMENTED, see feature request #5050.
Canceling Notifications
await LocalNotification.cancel({ notifications: [{ id: 1 }] });
Removes both displayed notifications and pending alarms (Android also deletes the persisted schedule entry).
Tap Callbacks
const handle = await LocalNotification.addListener('notificationReceived', (payload) => {
console.log(payload.id, payload.title, payload.body);
});
// handle.remove() to stop listening
When a notification is tapped, the payload flows through "platform callback → static routing → JS listener". If the tap happens before any JS listener is registered, the payload is queued and delivered when the first listener registers, so taps are never lost.
Android tap path (cold start only): when the app is killed and a notification is tapped, the payload lives in Activity.Intent. The plugin subscribes to Platform.ActivityStateChanged and parses the intent once the first Activity is created (the plugin is constructed before the Activity, so it cannot read CurrentActivity directly).
Platform Capabilities
| Capability | Android | iOS / Mac Catalyst | Windows | Web |
|---|---|---|---|---|
| Immediate | ✅ | ✅ (0.25s time trigger) | ✅ | ✅ |
| Timed | ✅ AlarmManager | ✅ UNCalendarNotificationTrigger | ❌ (throws NOT_IMPLEMENTED) | ✅ setTimeout |
| Tap callback | ⚠️ Cold start ✅ / warm start ❌ | ✅ (foreground/background/killed) | ✅ NotificationInvoked | ✅ |
| Reboot recovery | ✅ (persisted + BootReceiver) | ✅ (system persisted) | — | — |
Limitations
- Windows timed notifications: the Windows App SDK does not yet support scheduled notifications;
schedule()throws whenatis non-null. - Android warm-start taps: when the app is in the foreground, tap payloads arrive via
OnNewIntent, but MAUI offers no subscribable channel for plugins (Platform.OnNewIntentis a static method reserved for AppActions), sonotificationReceiveddoes not fire in this scenario. - Android device reboot: only non-expired schedules are restored after reboot (expired ones are not re-sent); recovery relies on the
RECEIVE_BOOT_COMPLETEDbroadcast, and some OEM ROMs require enabling auto-start in system settings. - iOS / Mac Catalyst cold-start taps: the system only delivers tap callbacks if the notification delegate is registered before
didFinishLaunchingreturns. The plugin constructs and registers the delegate insideCreateMauiApp(i.e. withinFinishedLaunching), so the timing holds and cold-start taps route correctly; a pending queue covers late JS listeners.