**Download SDK **Download Sample **Plugin API Docs

To integrate Pushwoosh PhoneGap Build plugin with your Phonegap Build project you have to follow the steps below:

1. Add Pushwoosh plugin in www/config.xml

**1.1.** In **www/config.xml** allow access to ***.pushwoosh.com**:
**2.** Add the Pushwoosh initialisation function to your javascript file
Do not forget to put the correct **Pushwoosh App ID**!
function initPushwoosh() { var pushNotification = cordova.require("com.pushwoosh.plugins.pushwoosh.PushNotification"); //set push notification callback before we initialize the plugin document.addEventListener('push-notification', function(event) { //get the notification payload var notification = event.notification; //display alert to the user for example alert(notification.aps.alert); //clear the app badge pushNotification.setApplicationIconBadgeNumber(0); }); //initialize the plugin pushNotification.onDeviceReady({pw_appid:"PUSHWOOSH_APP_ID"}); //register for pushes pushNotification.registerDevice( function(status) { var deviceToken = status['deviceToken']; console.warn('registerDevice: ' + deviceToken); }, function(status) { console.warn('failed to register : ' + JSON.stringify(status)); alert(JSON.stringify(['failed to register ', status])); } ); //reset badges on app start pushNotification.setApplicationIconBadgeNumber(0); }
In your **onDeviceReady** function add: `initPushwoosh();`


bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, // deviceready Event Handler // // The scope of 'this' is the event. In order to call the 'receivedEvent' function, we must explicitly call 'app.receivedEvent(...);' onDeviceReady: function() { app.receivedEvent('deviceready'); initPushwoosh(); },
**3.** Receiving iOS push notifications. See the following snippet of code in **initPushwoosh** function
document.addEventListener('push-notification', function(event) { var notification = event.notification; alert(notification.aps.alert); pushNotification.setApplicationIconBadgeNumber(0); });