»  IOS »  Native iOS SDK »  PhoneGap/Cordova iOS SDK

PhoneGap/Cordova iOS SDK

Phonegap/cordova ios sdk has never been so easy! Our extensive guides for all platforms currently available on the market show how to integrate push notifications within several minutes and with several lines of code. You can choose between native programming tools and a diverse set of cross-platform solutions. We are working hard on extending the list of supported SDKs, plugins and modules, so we advise coming back once in a while to see what's new. If you believe that some great tools should be added here, please let us know, and we will do our best to get them up and running!

To integrate BulkPush with your Phone Gap Cordova iOS application you need to do simple following steps:

1. Install the Plugin source code for Phonegap push notifications into your app by running the following command in the command line: phonegap plugin add

 

2. Whitelist *.BulkNotification.com domain in the config.xml file:

 

<accessorigin="*.BulkNotification.com"/>
 

 

 

In your onDeviceReady function add: initBulkPush();
Example:

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');
  initBulkPush(); 
},

 

4. Receiving iOS push notifications. See the following snippet of code in  initBulkPush() function

document.addEventListener('push-notification', 
function(event) 
{ 
varnotification = event.notification; alert(notification.aps.alert);
 BulkNotification.setApplicationIconBadgeNumber(0); });

 

Wasn’t it too easy?

Push Notifications Plugin API:

Sample iOS push notification payload: 
{ "aps": { 
"sound": "default", 
"alert": "push title" },
 u: '{key: value}' //user data }

© 2015 BulkPush.com By Broadnet Technologies Ltd.