09-29-2012 07:21 PM
I found this information but just not my app connects to the BBM
create a hpp name RegistrationHandler.hpp
#include "RegistrationHandler.hpp"
#include <bb/platform/bbm/RegistrationState>
#include <bb/platform/bbm/Context>
#include <bb/cascades/QmlDocument>
#include "Global.hpp"
RegistrationHandler::RegistrationHandler()
{
// Create the UI for the registration page and its components.
QmlDocument* qmlContent = QmlDocument::create("asset:///registration.qml");
if (qmlContent) {
Control* content = qmlContent->createRootObject<Control>();
this->setContent(content);
}
// Console Setup -- link BbmspBpsEventHandler to registrationCallback().
m_statusText = this->findChild<TextArea*>("statusText");
// Retrieve the button
m_continueButton = this->findChild<Button*>("continueButton");
// Connect the callback for the button.
QObject::connect(m_continueButton,
SIGNAL(clicked()),
this,
SLOT(continueToMainAppScreen()));
//TODO: Define your own UUID here.
//You can generate one here: http://www.guidgenerator.com/
m_uuid = QString::fromUtf8("14783db6-6871-4013-8048-2c77bf2 441bd");
// Your UUID goes here
this->appRegister(); // Attempt to register the application
}
// Application registration
void RegistrationHandler::appRegister()
{
qDebug() << "entering appRegister -> " << m_uuid;
qDebug() << "before new Context";
m_context = new bb::platform::bbm::Context(QUuid(m_uuid));
Global::instance()->setContext(m_context);
QObject::connect(m_context, SIGNAL(registrationStateUpdated(
bb::platform::bbm::RegistrationState::Type)),
this, SLOT(registrationStatus(
bb::platform::bbm::RegistrationState::Type)));
qDebug() << "after new Context and connect";
m_context->requestRegisterApplication();
qDebug() << "registered -> " << m_uuid;
}
// Retrieve the registration status
void RegistrationHandler::checkRegistrationAccess(){
bb::platform::bbm::RegistrationState::Type status =
bb::platform::bbm::RegistrationState::Unknown;
if (Global::instance()->getContext()) {
status = Global::instance()->getContext()->registrationStat e();
}
registrationStatus(status);
}
// Handle the registration status
void RegistrationHandler::registrationStatus(
bb::platform::bbm::RegistrationState::Type state) {
qDebug() << "Registration Status received";
switch(state){
case bb::platform::bbm::RegistrationState::Unregistered :
qDebug() << ("Unregistered");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::Unknown:
qDebug() << ("Access failed: unknown reason");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::Allowed:
qDebug() << "RegistrationPage::registrationStatus Access allowed";
m_statusText->setText("BBM SP registration succeeded. Press Continue.");
m_continueButton->setVisible(true);
break;
case bb::platform::bbm::RegistrationState::Pending:
qDebug() << "RegistrationState::Pending";
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::BlockedByUse r:
qDebug() << ("Access failed: blocked by user");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::BlockedByRIM :
qDebug() << ("Access failed: blocked by RIM" );
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::NoDataConnec tion:
qDebug() << ("Access failed: no data coverage");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::UnexpectedEr ror:
qDebug() << ("Access failed: unexpected error");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::InvalidUuid:
qDebug() << ("Access failed: invalid UUID");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::TemporaryErr or:
qDebug() << ("Access failed: temporary error");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::CancelledByU ser:
qDebug() << ("Access cancelled by user");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::MaxDownloads Reached:
qDebug() << ("Access failed: max downloads reached");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::MaxAppsReach ed:
qDebug() << ("Access failed: max apps reached");
this->registrationFailed();
break;
case bb::platform::bbm::RegistrationState::Expired:
qDebug() << ("Access failed: access expired");
this->registrationFailed();
break;
default:
qDebug() << ("Access failed: other errors");
this->registrationFailed();
break;
}
}
// Handle registration failure
void RegistrationHandler::registrationFailed()
{
//A generic error message is provided here.
//You can provide a different error message for each failure code to instruct
//the user on how to continue.
m_statusText->setText("BBM SP registration failed. Registration is required to connect with BlackBerry Messenger. Please restart the application to try again.");
m_continueButton->setVisible(false);
}
// Handle successful registration
void RegistrationHandler::continueToMainAppScreen()
{
//TODO: Display your application's main screen here
}create a qml name registration.qml
import bb.cascades 1.0
Container {
layout: StackLayout {
}
background: Color.create("#c6f66f")
Container {
horizontalAlignment: HorizontalAlignment.Center
TextArea {
id: statusText
objectName: "statusText"
text: "Please wait while the application registers with BBM SP."
editable: false
}
Button {
id: continueButton
objectName: "continueButton"
visible: false
text: "Continue"
layoutProperties: StackLayoutProperties {
}
horizontalAlignment: HorizontalAlignment.Center
onClicked: {
nextLabel.visible = true;
}
}
TextArea {
id: nextLabel
text: "Now you would display your application's main screen."
visible: false
backgroundVisible: false
textStyle {
color: Color.Black
fontWeight: FontWeight.Bold
}
}
}
}good from the main registration.qml invoked to connect but nothing happens. not connected or do anything that may be the solution to integrate the BBM, there is no example of this to see it better?
I gave him permission to BBM and add the library
Help Meee Please.
Thanks
10-06-2012 06:05 AM
did you do the config part first
Add the BBM Social Platform library and set the permissions for the bbmsp APIs.
i followed the same steps but can figure out why it wont work either
10-06-2012 12:50 PM
I was going through the docs. RegistrationHandler.cpp imports
#include "Global.hpp"
Where is this file?
I am only able to get the security prompt asking me to approve BBM access when I go through the BBM docs tutorial.
BUMP
10-06-2012 02:32 PM
I also think I have that doubt that the statute of integration is slightly incomplete or confusing, alguin hopefully help us.
10-06-2012 07:40 PM - edited 10-06-2012 07:48 PM
isnt
#include "Global.hpp"
just the name of there file i have mine as
#include "alphab.hpp"
the first file RegistrationHandler is suppose to be hpp/cpp im confused now @greenback you metioned cpp imports
10-07-2012 06:47 AM
10-09-2012 09:27 AM
I've attached a sample project that implements BBM registration. This sample is what the docs were based off of.
This sample, along with a few others that showcase BBM features will be posted to the BlackBerry Github site very soon.
10-16-2012 10:54 PM - edited 10-17-2012 12:02 AM
So iv been able to get my bbm sp registration page up and running but i dont know enough C++ to make the countinue button go to my main.qml page please help. just relook at the code can this be done from qml. im sure its something i just forgot.
10-17-2012 09:21 AM
More BBM samples have been posted in our github site here: https://github.com/blackberry/Cascades-Community-S
Have a look at some of the other BBMQt samples for examples that move on to another screen.
10-17-2012 09:38 AM - edited 10-17-2012 10:14 PM
I took a look at the all last night and really not sure what im looking for.
Im trying to figure out if moving to the next screen is done from the qml side with simple push function;
or if i need to lookup a C++ function in which case i wouldnt know what to look for.
Ok I started over and it seem the code has been changed im getting errros in this section of my RegistrationHandler.cpp - i cant figure this out.
void RegistrationHandler::appRegister()
{
qDebug() << "entering appRegister -> " << m_uuid;
qDebug() << "before new Context";
m_context = new bb::platform::bbm::Context(QUuid(m_uuid));
Global::instance()->setContext(m_context);
QObject::connect(m_context, SIGNAL(registrationStateUpdated(bb::platform::bbm: :RegistrationState::Type)),
this, SLOT(registrationStatus(bb::platform::bbm::Registr ationState::Type)));
qDebug() << "after new Context and connect";
m_context->requestRegisterApplication();
qDebug() << "registered -> " << m_uuid;
}
void RegistrationHandler::checkRegistrationAccess(){
bb::platform::bbm::RegistrationState::Type status = bb::platform::bbm::RegistrationState::Unknown;
if (Global::instance()->getContext()) {
status = Global::instance()->getContext()->registrationStat e();
}
registrationStatus(status);
}