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
Posts: 237
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi

[HELP] Retrieve BBM Chat Message on a onMessageAdded() ?

I can only listen for a BBM Message to come, but when I log the subject, body html and plain body it's blank. but not blank for emails and sms. 

 

Code for onMessageAdded()

 

void ApplicationUI::onMessageAdded(bb::pim::account::AccountKey accountId, bb::pim::message::ConversationKey conversationId, bb::pim::message::MessageKey messageId)
{
	Message message = m_messageService->message(accountId, messageId);
	handleMessage(message);
}

 code for handleMessage()

 

void ApplicationUI::handleMessage(Message message)
{
	QString msgBody = message.body(MessageBody::PlainText).plainText();
	QString msgBodyHTML = message.body(MessageBody::Html).plainText();
	QString msgSubject = message.subject();

	qDebug() <<
			"PLAIN: " << msgBody <<
			", \n\nHTML: " << msgBodyHTML <<
			", \n\nSUBJECT: " << msgSubject;
}

 

In addition, can we also listen for Facebook, Whatsapp, and other messages coming in the app?

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

Re: [HELP] Retrieve BBM Chat Message on a onMessageAdded() ?

[ Edited ]

There is no API to listen for the content of BBM chat messages.  Nor is there one to listen for incoming Facebook messages.

 

You can use the Invocation Framework to send messages using both of these services, but not receive.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 237
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi

Re: [HELP] Retrieve BBM Chat Message on a onMessageAdded() ?

Thank you for that. But can you please tell me what are all the supported messages it can listen for incoming messages? only SMS and Email or there's more? 

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

Re: [HELP] Retrieve BBM Chat Message on a onMessageAdded() ?

You can capture email, SMS and MMS using the MessageService class.

Mark Sohm
BlackBerry Development Advisor

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