10-26-2012 10:03 AM
Hi all,
I'm trying to get a contact list of my application users from the BBM Social Platform. I have the next code:
service = new ContactService(bbm->context()); // service.isValid() == false here QObject::connect(service,
SIGNAL(contactListUpdated()), this, SLOT(mycontactListUpdated()));
but mycontactListUpdated SLOT is never called. I thinks it is because I still don't have any users of my app. But, how can I check this??? Is there any other way of initialize the contact list??
Regards.
Solved! Go to Solution.
10-26-2012 11:19 AM
That'll notify you for changes. To poll for the list you could do this:
if (service->contactCount() > 0)
{
foreach (const Contact &contact, service->contacts())
{
qDebug() << contact.displayName();
}
}
10-29-2012 04:26 AM
The next step is tom retrieve the picture for every contact. This is my code:
service = new bb::platform::bbm::ContactService(bbm->context());
QObject::connect(service,
SIGNAL(displayPictureUpdated(const QString&, const bb::platform::bbm::ImageType::Type, const QByteArray&)),
this,
SLOT(displayPictureUpdated(const QString&, const bb::platform::bbm::ImageType::Type, const QByteArray&)));
if (service->contactCount() > 0)
{
foreach (const bb::platform::bbm::Contact &contact, service->contacts())
{
fprintf(stdout, "%s-%s \n",contact.displayName().toLocal8Bit().data(),con tact.handle().toLocal8Bit().data());
bool sent = service->requestDisplayPicture(contact.handle());
fprintf(stdout, "Request sent: %d \n", sent);
}
}
and this is the console output:
javier miguel-aEJIqsvCiG0X/ljARIyN8429CG9HE8woIhdiT7XXXXXX Request sent: 0
requestDisplayPicture returns false and displayPictureUpdated SLOT is never called.
Why is requestDisplayPicture returning false??
Regards.
10-31-2012 06:40 AM
It seems like displayPictureUpdated signal is only called if the contact has a picture set it his profile. So, If the signal is not called it is because the contact has no display picture set.
10-31-2012 06:40 AM
thnxx buddy
11-02-2012 01:37 AM
Hello,
I need contact list of BBM.So below code i put into blackberry BBM example(https://github.com/blackberry/Cascades-Community-S
But i not get any contact so please provide me some tips .
void RegistrationHandler::continueToMainAppScreen() {
//TODO: Your applications main screen would be displayed here:
ContactService *service = new ContactService(m_context, this);\
bool value = service->isValid();
qDebug() << value;
QString contact = QString("%1").arg(service->contactCount());
qDebug() << contact;
}
Thanks.
11-02-2012 03:23 AM
I think this method only obtain a list of BBM contacts that have the application installed and registered, not all your BBM contacts.
Regards.
11-02-2012 05:41 AM
K.So you know how to BBM contact fetach?
Thanks.
Tuesday
int q;
m_service = new bb::platform::bbm::ContactService(m_context, this);
if(m_service->contactCount()>0)
{
q = 1;
}
else
q = 0;
return q;I am not getting back the number of contacts, Im getting 0 number of contacts back. All im trying to do is to poll a list of the contacts. I cant poll a list until I get the number of contacts.
Wednesday
You can check if the service was initialized correctly with:
m_service.isValid()
On the other hand, remember this service only shows BBM contacts that have installed your app.
Regards.