megaplan-plugin-push
v2.5.11
Published
## Description
Downloads
11
Maintainers
Readme
Telerik Push Notifications Plugin
Description
The Telerik Push Notifications is based on the Phonegap Push Plugin.
It contains some bug fixes and new features and is easily integrated with Telerik Backend Services.
Using with Telerik Backend Services
In order to use the plugin with Telerik Backend Services, which supports iOS, Android, WP8 and Windows 8, take a look at the official documentation:
For further information you can take a look into the Backend Services hybrid push notifications samples:
Backend Services Push Hybrid simple application - basic example of using Push Notifications provided by Telerik Backend Services in a hybrid app built with Telerik AppBuilder.
Backend Services Push Hybrid advanced application - example of creating and receiving Push Notifications provided by Telerik Backend Services.
Features
Register a device for push notifications
var deviceSpecificOptions = { ... }; // set the device specific options here pushNotification.register(successHandler, errorHandler, deviceSpecificOptions);
Unregister a device from push notifications
pushNotification.unregister(successHandler, errorHandler, options);
iOS 8 interactive push notifications support (available from v2.5 and above)
// Get the push plugin instance var pushPlugin = window.plugins.pushNotification; // Define a new Read Action var readAction = { identifier: 'READ_IDENTIFIER', // mandatory title: 'Read', // mandatory activationMode: pushPlugin.UserNotificationActivationMode.Foreground, // default: Background destructive: false, // default: false authenticationRequired: true // default: false }; // Define a new Ignore Action. Defaults are commented out var ignoreAction = { identifier: 'IGNORE_IDENTIFIER', title: 'Ignore' //activationMode: pushPlugin.UserNotificationActivationMode.Background, //destructive: false, //authenticationRequired: false }; // Define a new Delete Action. Defaults are commented out. var deleteAction = { identifier: 'DELETE_IDENTIFIER', title: 'Delete', //activationMode: pushPlugin.UserNotificationActivationMode.Background, destructive: true, authenticationRequired: true }; // Define a read category with default and minimal context actions var readCategory = { identifier: 'READ_CATEGORY', // mandatory actionsForDefaultContext: [readAction, ignoreAction, deleteAction], // mandatory actionsForMinimalContext: [readAction, deleteAction] // mandatory }; // Define another category, with different set of actions var otherCategory = { identifier: 'OTHER_CATEGORY', // mandatory actionsForDefaultContext: [ignoreAction, deleteAction], // mandatory actionsForMinimalContext: [deleteAction] // mandatory }; // Register the category and the other interactive settings. pushPlugin.registerUserNotificationSettings( // the success callback which will immediately return (APNs is not contacted for this) onUserNotificationSettingsReady, // called in case the configuration is incorrect errorHandler, { // asking permission for these features types: [ pushPlugin.UserNotificationTypes.Alert, pushPlugin.UserNotificationTypes.Badge, pushPlugin.UserNotificationTypes.Sound ], // register these categories categories: [ readCategory, otherCategory ] } );
iOS 9 text input support (available from v3.1 and above)
// Define a Text Input Action var replyAction = { identifier: 'REPLY_IDENTIFIER', title: 'Reply', activationMode: window.plugins.pushNotification.UserNotificationActivationMode.Background, destructive: false, authenticationRequired: true, behavior: window.plugins.pushNotification.ActionBehavior.TextInput };
IMPORTANT: When using interactive iOS push notifications with background activation mode, you must call the following function, once you are done processing the push notification object:
pushPlugin.notificationProcessed()
This way you'll be able to execute your javascript callback and then notify the operating system to put back your app in background, which is the correct approach to handle such notifications by iOS.
Set an application icon badge number (iOS only)
// sets the application badge to the provided value // if badge === 0 clears out the badge pushNotification.setApplicationIconBadgeNumber(successCallback, errorCallback, badge)
Check if the user has disabled push notifications on the device
// Checks whether Push Notifications are enabled for this Application on the Device pushNotification.areNotificationsEnabled(successCallback, errorCallback, options);
Handling multiple notifications on Android devices - Since version 2.4.3 of this plugin, all new notifications are stacked in the notification panel and do not replace previous notifications by default. To change this behavior and control which notifications are replaced and which are not, pass a notId key in the notification payload.
To always stack new notifications, don't pass the notId value.
"data": { "title": "Hello", "message": "Always stack the notification.", }
To always replace existing notifications, use the same positive (> 0) notId value for all notifications.
"data": { "title": "Hello", "message": "Always replace the notification.", "notId": 1 // send the same notId every time }
If your application supports different kinds of push notifications, you can use a mixed approach based on your business logic. Notifications that are sent with the same notId value are replaced automatically, so only the last one is visible. For the rest of the notifications which should be stacked, just do not send a notId key in the payload.
"data": { "title": "Hello", "message": "This notification will be stacked." "notId": 5 } "data": { "title": "Hello", "message": "This notification will be stacked." "notId": 6 } "data": { "title": "Hello", "message": "This notification will replace the first one." "notId": 5 }
## LICENSE
The MIT License
Copyright (c) 2012 Adobe Systems, inc.
portions Copyright (c) 2012 Olivier Louvignes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.