Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

New Contributor
Posts: 4
Registered: ‎08-13-2013
My Device: I'm a blackberry developer
My Carrier: I'm a blackberry developer
Accepted Solution

Push via UrbanAirship on web application

I want to use urban airship to send the push notifications to a web application. I found an example on https://github.com/blackberry/Cascades-Community-Samples/tree/master/UrbanAirshipClient but it is a c/c++ app. Is there any way to perform push on a web app via Urban Airship?

Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push via UrbanAirship on web application

[ Edited ]

Hi there, indeed this is possible.


Urban Airship servers simply push to BlackBerry Push Servers, which then relay that push to the end-user device. This means that the only additional step that is really required is, when registering with the push service, to also register witih Urban Airship so that link between Urban Airship, the BlackBerry Push Server, and the end-user's device exists.


The Push Service registration is mostly the same. You need to create a PushService object:


			invokeTargetId: INVOKE_TARGET_ID,


On createPushServiceSuccess, you will create the channel per the usual method.


/* We created the PushService instance. */
function createPushServiceSuccess(service) {
	/* Store our PushService object. */
	pushService = service;

	/* ...other actions here potentially... */

	/* Create channel to receive pushes. */

And finally, on the channel creation, we'll register with Urban Airship.


/* When a channel is attempting to be created, this will trigger. */
function createChannelCallback(result, token) {
	var xhr;
	if (result === blackberry.push.PushService.SUCCESS) {
		/* On success, we'll register with Urban Airship. */
		xhr = new XMLHttpRequest();
		xhr.onload = function () {
			console.log('Urban Airship: ' + this.response);
		xhr.setRequestHeader('Authorization', 'Basic ' + URBAN_AIRSHIP_APPENCODED);
	} else {
		console.log('createChannelCallback: ' + result);

Above, we're ensuring the channel was successfully created. The xhr request is purely related to Urban Airship and is the extra piece we need. We're using a few (previously) defined constants.


  • HTTPS_GO_URBANAIRSHIP_COM_API_DEVICE_PINS is a string set to the default Urban Airship PIN registration URL.


  • URBAN_AIRSHIP_APPENCODED is a combination of two other strings; encoded using window.btoa(). 


  • URBAN_AIRSHIP_APPKEY and URBAN_AIRSHIP_APPSECRET are obtained from the Urban Airship console when you configure your application as follows.



Finally, the last piece you would need to do is supply your BlackBerry Push credentials in the Urban Airship console itself. It is important to use the full URLs that include your CPID when you fill out that information; this is the information that is sent to you by BlackBerry when you sign up for EVAL or PROD credentials.


Beyond that, the push implementation, invocation, etc. would all follow the regular WebWorks Push Application structure.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.