Radical
How-to guides

Schedule a local notification

Schedule a reminder, cancel it, and update the app badge.

Enable notifications

Apply capability setup with internalPlugins.notifications: true:

pnpm add @capacitor/local-notifications@8.3.1 @capawesome/capacitor-badge@8.0.4 @capacitor/network@8.0.1

Request permission

Connect a user action to:

const permission = useNotificationPermission(); // @akshatowo/radical/react
const notifications = useNotifications();
permission.request();

Schedule a reminder

Call from a button after permission is granted:

notifications.schedule({
  id: 22,
  title: "Your report is ready",
  delaySeconds: 5,
  route: "/reports",
});

You see the reminder when the OS delivers it.

Add controls

Connect the required actions:

ActionCall or guide
Cancelnotifications.cancel(22)
Badge, where supportednotifications.setBadge(1), .clearBadge()
Tap navigationApp-scoped watcher
Native pushFirebase setup

Keep the page open for browser reminders. See inputs and errors.

Request exact alarms

Request access

After the initial check, offer a separate request button only for "denied":

const exactAlarms = useExactAlarmPermission(); // @akshatowo/radical/react
// Request button:
exactAlarms.request();
// Refresh after external settings changes:
exactAlarms.check();

Return from settings

Allow Alarms & reminders, then wait for "granted" before enabling scheduling.

Schedule again

Call notifications.schedule() from the button with delaySeconds: 5.

ResultAction
value.warning?.code === "OS-PLUG-LNOT-0017"Tell the user the alarm is inexact
Access granted after inexact schedulingReschedule the same reminder to replace it

Request access before scheduling; time in settings consumes an existing reminder's delay.

See exact-alarm limits.

On this page