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
Developer
sgallego84
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.

Please use plain text.
Administrator
MSohm
Posts: 14,241
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
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.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
sgallego84
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.

Please use plain text.
Developer
sgallego84
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.

 

Please use plain text.
New Contributor
shikhertech
Posts: 2
Registered: ‎10-31-2012
My Device: curve
My Carrier: airtel

Re: BBM Social Platform

thnxx buddy

Please use plain text.
Developer
shahumang8
Posts: 576
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.

Please use plain text.
Developer
sgallego84
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.

Please use plain text.
Developer
shahumang8
Posts: 576
Registered: ‎08-09-2010
My Device: Not Specified

Re: BBM Social Platform

K.So you know how to BBM contact fetach?

 

Thanks.

Please use plain text.
Contributor
mark12
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.

 

 

Please use plain text.
Developer
sgallego84
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.

Please use plain text.