BlackBerry 10 Cascades

BlackBerry Cascades Integration Guide

Download SDK
Download Sample

SDK contains the source code for BlackBerry 10 Cascades platform. download it from our repo first.

List the libraries to be defined in the .pro file to avoid compilation error:

LIBS += -lbb
LIBS += -lbbdevice
LIBS += -lbbsystem
LIBS += -lbbnetwork
LIBS += -lbbplatform
LIBS += -lbbdata

IMPORTANT: For push evaluation the PPG_URL should use http:// scheme, not https://
#define PPG_URL "”

1. In your main App add push notifications service:

PushNotificationService m_pushNotificationService;  

2. Initialize push service:


Note that INVOKE_TARGET_KEY_PUSH must match the invoke target specified in bar-descriptor.xml. For example, here is Invoke target key for receiving new push notifications:


Note that INVOKE_TARGET_KEY_OPEN must match the invoke target specified in bar-descriptor.xml. Here is a sample of an Invoke target key for selecting notification in the BlackBerry Hub:

3. Connect push notification service signals and slots:

QObject::connect(&m_pushNotificationService, SIGNAL(registeredForPushNotifications(const QString &)),  
        this, SLOT(registeredForPushNotifications(const QString &)));  
QObject::connect(&m_pushNotificationService, SIGNAL(errorRegisteringForPushNotifications(const QString &)),  
        this, SLOT(errorRegisteringForPushNotifications(const QString &)));  

Example of callback functions:

void App::registeredForPushNotifications(const QString & token)  
    qDebug() << "subscribed for push with token: " << token;  
void App::errorRegisteringForPushNotifications(const QString & error)  
    qDebug() << "error subscribing for push: " << error;  

4. Initialize push session:


5. Subscribe for push notifications:


6. Handle push notifications:

void App::onInvoked(const InvokeRequest &request)  
    if (request.action().compare(BB_PUSH_INVOCATION_ACTION) == 0) {  
        qDebug() << "Received push action";  
        // Received an incoming push  
        // Extract it from the invoke request and then process it  
        PushPayload payload(request);  
        if (payload.isValid()) {  
            //call pushwoosh handler for stats etc.  
            //handle push  
    } else if (request.action().compare(BB_OPEN_INVOCATION_ACTION) == 0){  
        qDebug() << "Received open action";  
        // Received an invoke request to open an existing push (ie. from a notification in the BlackBerry Hub)  
        // The payload from the open invoke is the seqnum for the push in the database  
        // Process opened push here  

7. In bar-description.xml add permissions for push and device info:

<permission system="true">_sys_use_consumer_push</permission>  

8. Also add Invoke actions:

<!-- Need to put an invoke entry here for push -->  
<!-- The id here must match the invokeTargetID in the PushService constructor -->  
<invoke-target id="INVOKE_TARGET_KEY_PUSH">  
<!-- Have an invoke entry here for when a notification is clicked on in the BlackBerry Hub -->  
<!-- This will cause the application to be opened -->  
<invoke-target id="INVOKE_TARGET_KEY_OPEN">  

That’s it, now the application should be able to subscribe a device to receive push notifications, and receive them properly.

Get/Set tags:

Include necessary headers:

#include "pushwoosh/request/PWRequest.h"
#include "pushwoosh/request/PWSetTagsRequest.h"
#include "pushwoosh/request/PWGetTagsRequest.h"

Define callback SLOTS:

void App::setTagsFinished(PWRequest * request)
        QString error = request->getError();
        qDebug() << "Set Tags Error: " << error;
    qDebug() << "Set Tags Success";
void App::getTagsFinished(PWRequest * request)
        QString error = request->getError();
        qDebug() << "Get Tags Error: " << error;
    PWGetTagsRequest * req = (PWGetTagsRequest *) request;
    QVariantMap tags = req->getTags();
    QString reqString;
    bb::data::JsonDataAccess jda;
    jda.saveToBuffer(tags, &reqString);
    qDebug() << "Get Tags Success: " << reqString;

To set tags call:

QVariantMap map;
map["Hello"] = 5;
map["String"] = "Value";
QList<QString> array;
map["Array"] = QVariant(array);
m_pushNotificationService.setTags(map, this, SLOT(setTagsFinished(PWRequest*)));

To get tags call:

m_pushNotificationService.getTags(this, SLOT(getTagsFinished(PWRequest*)));

BlackBerry 10 Cascades

BlackBerry Cascades Integration Guide