← Plugins / Local Notifications
This popular community plugin schedules notifications that fire entirely on the device — no server or network required. Use it for reminders, alarms, timers and offline alerts, with full control over the title, text, timing and the action a tap should trigger.
cordova plugin add cordova-plugin-local-notification
The plugin is exposed as cordova.plugins.notification.local after deviceready:
| Method | Description |
|---|---|
schedule(options, cb) | Schedule one notification or an array of them. |
requestPermission(cb) | Ask the user for permission to post notifications. |
on(event, cb) | Listen for schedule, trigger, click, clear or cancel. |
cancel(id, cb) / cancelAll(cb) | Cancel a scheduled notification, or all of them. |
getScheduled(cb) | Return all currently scheduled notifications. |
| Key | Description |
|---|---|
id | A unique number you use later to cancel or update it. |
title / text | The heading and body shown in the notification. |
trigger | When to fire, e.g. { at: new Date(...) } or { in: 1, unit: 'hour' }. |
sound | Custom sound to play, or false for silent. |
data | Arbitrary payload returned to your click handler. |
Request permission, then schedule a reminder for 30 minutes from now:
document.addEventListener("deviceready", onReady, false);
function onReady() {
var local = cordova.plugins.notification.local;
local.requestPermission(function (granted) {
if (!granted) return;
local.schedule({
id: 1,
title: "Stand up!",
text: "Time for a quick stretch.",
trigger: { in: 30, unit: "minute" }
});
});
local.on("click", function (notification) {
console.log("Tapped: " + notification.title);
});
}
requestPermission before scheduling.id so you can update or cancel it later.