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

Native Development

Posts: 74
Registered: ‎12-17-2009
My Device: Z30
My Carrier: O2

Connecting to BBM social platform, getting Device PIN, invoking BBM


I am trying to do all 3 but I am new to C++ and I am still trying to get my the BBM Server simulator to work so I am not sure if it works right now before I continue. I am not sure how to use all 3 services at one go.


I have basically copied and paste the RegistrationHandler, ProfileEditor and Profile classes from the samples. But I am not sure how to properly add them to my main.cpp.


In fact, I am not sure if I should be adding them to the auto-generated applicationui.cpp (would be great if i can just merge it into the main.cpp but I am not sure how!) 


1) Would it be correct if I do my code the way below

2) I keep getting back an error, even though I have not touched the line that

prototype for 'ApplicationUI::ApplicationUI(bb::cascades::Application*)' does not match any in class


3) How do I actually include the invoke framework into my app?

(sorry for the noob questions!)



#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_

#include <QObject>

//Get Device Pin
#include <bb/device/HardwareInfo>
#include <BBMProfile.hpp>
#include <BBMProfileEditor.hpp>
#include <BBMRegistrationHandler.hpp>

namespace bb
    namespace cascades

class QTranslator;

 * @brief Application object

class ApplicationUI : public QObject
    ApplicationUI(bb::cascades::Application *app);
    virtual ~ApplicationUI() { }


#endif /* ApplicationUI_HPP_ */


#include "applicationui.hpp"

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>

using namespace bb::cascades;

ApplicationUI::ApplicationUI(bb::cascades::Application *app):

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    //BBM Registration + to regenerate Qstring from http://www.guidgenerator.com/
    const QString uuid(QLatin1String("5d737629-05e8-4703-943f-ee07869a8e2c"));

    RegistrationHandler *registrationHandler = new RegistrationHandler(uuid, &app);
    Profile *profile = new Profile(registrationHandler->context(), &app);
    bool ok = QObject::connect(registrationHandler, SIGNAL(registered()), profile, SLOT(show()));

// get PIN
    HardwareInfo *hardwareinfo = new HardwareInfo();
    QString devicePIN = hardwareinfo.pin();
    qml-> setContextProperty("_hardwareInfo", hardwareinfo);
    qml -> setContextProperty ("_devicePIN", devicePIN);
    AbstractPane *root = qml->createRootObject<AbstractPane>();



#include <bb/cascades/Application>

#include "applicationui.hpp"

#include <Qt/qdeclarativedebug.h>

using namespace bb::cascades;

Q_DECL_EXPORT int main(int argc, char **argv)
    Application app(argc, argv);

    new ApplicationUI(&app);

    return Application::exec();