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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 89
Registered: ‎10-18-2012
My Device: BB Z10
My Carrier: -
Accepted Solution

BBM Social Platform

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.

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

Re: BBM Social Platform

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();
	}
}

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 89
Registered: ‎10-18-2012
My Device: BB Z10
My Carrier: -

Re: BBM Social Platform

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(),contact.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.

Developer
Posts: 89
Registered: ‎10-18-2012
My Device: BB Z10
My Carrier: -

Re: BBM Social Platform

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.

 

Highlighted
New Contributor
Posts: 2
Registered: ‎10-31-2012
My Device: curve
My Carrier: airtel

Re: BBM Social Platform

thnxx buddy

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: BBM Social Platform

Hello,

 

     I need contact list of BBM.So below code i put into blackberry BBM example(https://github.com/blackberry/Cascades-Community-Samples/tree/master/BBMBaseSampleRegistration).

 

   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.

Developer
Posts: 89
Registered: ‎10-18-2012
My Device: BB Z10
My Carrier: -

Re: BBM Social Platform

I think this method only obtain a list of BBM contacts that have the application installed and registered, not all your BBM contacts.

 

Regards.

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: BBM Social Platform

K.So you know how to BBM contact fetach?

 

Thanks.

Contributor
Posts: 33
Registered: ‎01-02-2012
My Device: 9900
My Carrier: bell

Re: BBM Social Platform

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.

 

 

Developer
Posts: 89
Registered: ‎10-18-2012
My Device: BB Z10
My Carrier: -

Re: BBM Social Platform

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.