This is a fork of fac/LocalNotification which in the end is a fork of katzer/cordova-plugin-local-notifications.
I did some small changes as I needed actions on notifications for Android and iOS. I mostly pulled together some pull requests into this branch and modified some tiny bits in order to have everything as I needed.
So far, actions are working on Android and iOS 10.
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,
sound: "file://sounds/reminder.mp3",
data: { meetingId:"123#fg8" },
actions: [
{
title: string,
identifier: //number for Android and String for iOS. Might work with string for both.
},
category: string, //Mandatory for iOS with actions
openApp: boolean
});
cordova.plugins.notification.local.on("click", function (notification) {
joinMeeting(notification.data.meetingId);
});
cordova.plugins.notification.local.on("action", function (notification, activationMode, actionIdentifier) {
joinMeeting(notification.data.meetingId);
//On iOS, actionIdentifier is the string of the identifier related to the action which was clicked.
//On Android it is the full action object which was clicked.
});
actions
is an array of buttons. You can add any other object into this array and it will be passed into the callback.
category
is also needed for iOS.
openApp
is available only to Android thanks to the PR from richturner. If this is set to true
, the app will open when clicking the notifications or action buttons. When set to false
the app will only open when the notification is clicked (not the buttons).
See issues.
I did some of the changes in a hurry and lost some of the commit owners. This was my mistake and should be fixed anytime soon. I will add a list of the PRs and fixes that I used to create this fork. Sorry about that.
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.
Users see notifications in the following ways:
- Displaying an alert or banner
- Badging the app’s icon
- Playing a sound
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.
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.
The plugin is installable from source and available on Cordova Plugin Registry and PhoneGap Build.
Find out more informations here in our wiki.
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.
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
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.
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
We appricate any feature proposal and support for their development. Please describe them here.
Find out more informations here in our wiki.
Your support is needed. If you use the plugin please send us a drop through the donation button.
Thank you!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
This software is released under the Apache 2.0 License.
© 2013-2016 appPlant UG, Inc. All rights reserved