Welcome!

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

Reply
New Developer
Posts: 10
Registered: ‎12-08-2013
My Device: Z10
My Carrier: *

Fail to read BBM Contacts ( bb::platform::bbm::ContactService->Contacts return empty)

[ Edited ]

hi,

i have been trying to read bbm contacts. i have used BB example as base and connection, validation, registration finished successfully BUT, when i try to read the contacts, i get 0 contacts.

i have added all needed permissions.

i put part of the code which i use after im getting "Allowed" status (registration ok):

 

  if (m_context.isAccessAllowed()) {

        m_isAllowed = true;

    } else {

        m_isAllowed = false;

    }

///    qDebug() << "Finished BBM Social Platform registration, success="

////        << m_isAllowed << "temporaryError=" << m_temporaryError;

 

    emit stateChanged();

    bool allowed = m_context.isAccessAllowed();

 

  m_bbmContactService = new bb:Smiley Tonguelatform::bbm::ContactService(&m_context, this);

 

 

 

// Connect the update signals to the model update slot

bool ok = QObject::connect(m_bbmContactService, SIGNAL(contactListUpdated()), this, SLOT (updateModel()));

Q_ASSERT(ok);

 

ok = QObject::connect(m_bbmContactService, SIGNAL(applicationEnabled(const QString&)), this, SLOT (updateModel()));

Q_ASSERT(ok);

 

ok = QObject::connect(m_bbmContactService, SIGNAL(applicationDisabled(const QString&)), this, SLOT (updateModel()));

Q_ASSERT(ok);

 

ok = QObject::connect(m_bbmContactService, SIGNAL(contactUpdated(const QString&)), this, SLOT(contactUpdated(const QString&)));

Q_ASSERT(ok);

 

 

  bb:Smiley Tonguelatform::bbm::ContactService* ser = new bb:Smiley Tonguelatform::bbm::ContactService(&m_context, this);

  bool servalid = ser->isValid();

  ser->registerUserData();

  bool servalid2 = ser->isValid();

  int contxts = ser->contactCount();

  bool isValid = m_bbmContactService->isValid();

 

  int contactsCount  = m_bbmContactService->contactCount();

  QList<bb:Smiley Tonguelatform::bbm::Contact> contacts = m_bbmContactService->contacts();

int count = contacts.count();

 

COUNT IS ALWAYS 0 AND I HAVE BBM + BBM CONTACTS ON MY DEVICE

PLEASE HELP!!!

thanks in advance,

itzik

 

Highlighted
BlackBerry Development Advisor
Posts: 15,813
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Fail to read BBM Contacts ( bb::platform::bbm::ContactService->Contacts return empty)

Note that this API only returns BBM contacts who also have the application installed.  Have any of your contacts installed your application?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.