# pushplugin

> This plugin allows your application to receive push notifications on Android, iOS, WP8 and Windows8 devices. Android uses Google Cloud Messaging. iOS uses Apple APNS Notifications. WP8 uses Microsoft MPNS Notifications. Windows8 uses Microsoft

Latest version **2.5.9** (published 2015-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install pushplugin
pnpm add pushplugin
yarn add pushplugin
bun add pushplugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.5.9 |
| Published | 2015-08-12 |
| First published | 2015-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Telerik |
| Maintainers | bpitcher |
| Keywords | ecosystem:cordova, cordova-android, cordova-ios, cordova-wp8, cordova-windows8 |

## Links

- npm: https://www.npmjs.com/package/pushplugin
- Repository: https://github.com/orcasgit/PushNotification
- Homepage: https://github.com/orcasgit/PushNotification#readme
- Issues: https://github.com/orcasgit/PushNotification/issues
- npm.io page: https://npm.io/package/pushplugin

## Dependencies (1)

- [plugman](https://npm.io/package/plugman.md) undefined0.23.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.5.9 (latest) — 2015-08-12

## README

# Telerik Push Notifications Plugin

## Description

The Telerik Push Notifications is based on the [Phonegap Push Plugin](https://github.com/phonegap-build/PushPlugin).

It contains some bug fixes and new features and is easily integrated with [Telerik Backend Services](http://www.telerik.com/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:

- [Getting started with Push Notifications in a Hybrid Application with Telerik Backend Services](http://docs.telerik.com/platform/backend-services/getting-started/push-notifications/integrating-push-hybrid)

For further information you can take a look into the Backend Services hybrid push notifications samples:

- [Backend Services Push Hybrid simple application](https://github.com/telerik/backend-services-push-hybrid) - 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](https://github.com/telerik/backend-services-push-hybrid-advanced) - 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 v.2.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
            		]
          	}
      	);
            

- 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
			}
 


##<a name="license"></a> 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.

---
_Source: https://npm.io/package/pushplugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
