Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cordova-plugin-local-notifications-gd

katzer5Apache-2.00.8.4

Schedules and queries for local notifications

appplant, notification, local notification, cordova, ecosystem:cordova, cordova-android, cordova-ios, cordova-windows

readme

npm version PayPayl donate button

Important notice

  1. Its been a while that the plugin has received major updates and bug fixes. My (free)time is limited and I have multiple projects to maintain. Once I've updated my background-mode plugin the local-notification plugin will get an official release supporting ios10. The ios10 branch will be merged into the master as well.

  2. For the future I am looking for other opportunities to support and enhance the plugin. That might be a crowdfunding campain or adding other core maintainers. Everyone with an serious interest is welcome to contact me!

  3. I am aware of the growing number of open issues and pull. Therefore, there's a new ticket template that can be found here. For every new issue please add an filled template. That will help rwillett and me to faster response to your issue. If you ignore this template, we'll ignore your issue.

UPDATE (22.05.2017) I've released v0.8.5 with contains the code from ios10 branch as it is. I will start working on a new major version while dropping support for older SDKs. I will try to include all you PRs.

Thanks for using my plugin and for your support!
Sebastián Katzer

Cordova Local-Notification Plugin

The essential purpose of local notifications is to enable an application to inform its users that it has something for them — for example, a message or an upcoming appointment — when the application isn’t running in the foreground.
They are scheduled by an application and delivered on the same device.

How they appear to the user

Users see notifications in the following ways:

  • Displaying an alert or banner
  • Badging the app’s icon
  • Playing a sound

Examples of Notification Usage

Local notifications are ideally suited for applications with time-based behaviors, such as calendar and to-do list applications. Applications that run in the background for the limited period allowed by iOS might also find local notifications useful.
For example, applications that depend on servers for messages or data can poll their servers for incoming items while running in the background; if a message is ready to view or an update is ready to download, they can then present a local notification immediately to inform their users.

Supported Platforms

The current 0.8 branch supports the following platforms:

  • iOS (>= 8)
  • Android (SDK >=7)
  • Windows 8.1 (added with v0.8.2)
  • Windows Phone 8.1 (added with v0.8.2)
  • Windows 10 (added with v0.8.3)

Find out more informations here in our wiki.

Installation

The plugin is installable from source and available on Cordova Plugin Registry and PhoneGap Build.

Find out more informations here in our wiki.

I want to get a quick overview

All wiki pages contain samples, but for a quick overview the sample section may be the fastest way.

Find out more informations here in our wiki.

I want to get a deep overview

The plugin supports scheduling local notifications in various ways with a single interface. It also allows you to update, clear or cancel them. There are different interfaces to query for local notifications and a complete set of events to hook into the life cycle of local notifications.

Find out more about how to schedule single, multiple, delayed or repeating local notifications here.
Informations about events like click or trigger can be found here.

To get a deep overview we recommend to read about all the topics in our wiki and try out the Kitchen Sink App

I want to see the plugin in action

The plugin offers a kitchen sink sample app. Check out the cordova project and run the app directly from your command line or preferred IDE.

Find out more informations here in our wiki.

What's new

We are proud to announce our newest release version 0.8.x. Beside the hard work at the office and at the weekends it contains a lot of goodies, new features and easy to use APIs.

Find out more informations here in our wiki.

Sample

The sample demonstrates how to schedule a local notification which repeats every week. The listener will be called when the user has clicked on the local notification.

cordova.plugins.notification.local.schedule({
    id: 1,
    title: "Production Jour fixe",
    text: "Duration 1h",
    firstAt: monday_9_am,
    every: "week",
    sound: "file://sounds/reminder.mp3",
    icon: "http://icons.com/?cal_id=1",
    data: { meetingId:"123#fg8" }
});

cordova.plugins.notification.local.on("click", function (notification) {
    joinMeeting(notification.data.meetingId);
});

Find out more informations here in our wiki.

I would like to propose new features

We appricate any feature proposal and support for their development. Please describe them here.

Find out more informations here in our wiki.

Supporting

Your support is needed. If you use the plugin please send us a drop through the donation button.

Thank you!

PayPayl donate button

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This software is released under the Apache 2.0 License.

© 2013-2016 appPlant UG, Inc. All rights reserved

changelog

ChangeLog

Please also read the Upgrade Guide for more information.

Version 0.8.4 (04.01.2016)

  • Bug fixes
    • SyntaxError: missing ) after argument list

Version 0.8.3 (03.01.2016)

  • Platform enhancements
    • Support for the Crosswalk Engine
    • Support for cordova-ios@4 and the WKWebView Engine
    • Support for cordova-windows@4 and Windows 10 without using hooks
  • Enhancements
    • New color attribute for Android (Thanks to @Eusebius1920)
    • New quarter intervall for iOS & Android
    • smallIcon is optional (Android)
    • update checks for permission like schedule
    • Decreased time-frame for trigger event (iOS)
    • Force every: to be a string on iOS
  • Bug fixes
    • Fixed #634 option to skip permission check
    • Fixed #588 crash when basename & extension can't be extracted (Android)
    • Fixed #732 loop between update and trigger (Android)
    • Fixed #710 crash due to >500 notifications (Android)
    • Fixed #682 crash while resuming app from notification (Android 6)
    • Fixed #612 cannot update icon or sound (Android)
    • Fixed crashing get(ID) if notification doesn't exist
    • Fixed #569 getScheduled returns two items per notification
    • Fixed #700 notifications appears on bootup

Version 0.8.2 (08.11.2015)

  • Submitted to npm
  • Initial support for the windows platform
  • Re-add autoCancel option on Android
  • Warn about unknown properties
  • Fix crash on iOS 9
  • Fixed webView-Problems with cordova-android 4.0
  • Fix get* with single id
  • Fix issue when passing data in milliseconds
  • Update device plugin id
  • Several other fixes

Version 0.8.1 (08.03.2015)

  • Fix incompatibility with cordova version 3.5-3.0
  • Fire clear instead of cancel event when clicked on repeating notifications
  • Do not fire clear or cancel event when clicked on persistent notifications

Version 0.8.0 (05.03.2015)

  • Support for iOS 8, Android 2 (SDK >= 7) and Android 5
    • Windows Phone 8.1 will be added soon
  • New interfaces to ask for / register permissions required to schedule local notifications
    • hasPermission() and registerPermission()
    • schedule() will register the permission automatically and schedule the notification if granted.
  • New interface to update already scheduled|triggered local notifications
    • update()
  • New interfaces to clear the notification center
    • clear() and clearAll()
  • New interfaces to query for local notifications, their properties, their IDs and their existence depend on their state
    • isPresent(), isScheduled(), isTriggered()
    • getIds(), getAllIds(), getScheduledIds(), getTriggeredIds()
    • get(), getAll(), getScheduled(), getTriggered()
  • Schedule multiple local notifications at once
    • schedule( [{...},{...}] )
  • Update multiple local notifications at once
    • update( [{...},{...}] )
  • Clear multiple local notifications at once
    • clear( [1, 2] )
  • Cancel multiple local notifications at once
    • cancel( [1, 2] )
  • New URI format to specify sound and image resources
    • http(s): for remote resources (Android)
    • file: for local resources relative to the www folder
    • res: for native resources
  • New events
    • schedule, update, clear, clearall and cancelall
  • Enhanced event informations
    • Listener will get called with the local notification object instead of only the ID
  • Multiple listener for one event
    • on(event, callback, scope)
  • Unregister event listener
    • un(event, callback)
  • New Android specific properties
    • led properties
    • sound and image accepts remote resources
  • Callback function and scope for all interface methods
    • schedule( notification, callback, scope )
  • Renamed add() to schedule()
  • autoCancel property has been removed
    • Use ongoing: true for persistent local notifications on Android
  • Renamed repeat intervals
    • second, minute, hour, day, week, month and year
  • Renamed some local notification properties
    • date, json, message and repeat
    • Scheduling local notifications with the deprecated properties is still possible
  • Kitchen Sink sample app
  • Wiki