To integrate Pushwoosh into your BlackBerry Phonegap / HTML5 Webworks application you need to do simple following steps:
1. Register for Blackberry Push Notifications here: https://www.blackberry.com/profile/?eventId=8121
2. Download pushwoosh.js script from https://github.com/shaders/phonegap-cordova-push-notifications/blob/master/BlackBerry/pushwoosh.js and place it in your project folder. Change the YOUR_PUSHWOOSH_APP_ID in the script to your Pushwoosh Application ID from the control panel.
3. Add the pushwoosh script to the index.html file before your master script file. Replace ‘YOUR_PUSHWOOSH_APP_ID’ with your Pushwoosh Application ID. You will also need jquery.js. For example:
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="pushwoosh.js" type="text/javascript"></script> PushWoosh.appCode = 'YOUR_PUSHWOOSH_APP_ID'; <script src="master.js" type="text/javascript"></script>
4. In your onDeviceReady function add the call to the openBISPushListener() function:
function onDeviceReady() {
//SOME OTHER CODE
openBISPushListener();
}
5. In your master javascript file add the following code:
var port = THE_PORT_FROM_BB_REGISTRATION;
var serverUrl = "http://pushapi.eval.blackberry.com";
var appId = "APP_ID_FROM_BB_REGISTRATION";
var max = 100;
var wakeUpPage = "push.html";
function openBISPushListener() {
try {
var ops = {port : port, appId : appId, serverUrl : serverUrl, wakeUpPage : wakeUpPage, maxQueueCap : max};
blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
}
catch (err) {
alert(err);
}
}
function onRegister(status) {
if (status == 0) {
PushWoosh.register(function(data) {
alert("PushWoosh register success: " + JSON.stringify(data));
}, function(errorregistration) {
alert("Couldn't register with PushWoosh" + errorregistration);
});
}
else if (status == 1) {
alert("push register status network error");
}
else if (status == 2) {
alert("push register status rejected by server");
}
else if (status == 3) {
alert("push register status invalid parameters");
}
else if (status == -1) {
alert("push register status general error");
}
else {
alert("push register status unknown");
}
}
function onData(data) {
alert("Push notifications received. Data is " + blackberry.utils.blobToString(data.payload));
try {
return 0; //indicate acceptance of payload for reliable push
}
catch (err) {
alert(err);
}
}
function onSimChange() {
//handle Sim Card change
}
That’s it! Easy, isn’t it? You are ready to receive push notifications for your BlackBerry HTML5 Webworks application!
In Pushwoosh app configuration enter: http://cpXXX.pushapi.eval.blackberry.com (replacing XXX with your CPID) as provided by BlackBerry.
The server sends the notification as JSON payload in the following format:
{
m:'the message itself',
h: 42, // html page id ex: https://cp.pushwoosh.com/content/42
u: '{key: value}', //user data
l: 'http://google.com' //link to redirect the application to
}


Devices connected —
Pushes delivered —