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: 75
Registered: ‎08-15-2013
My Device: blackberry curve 9630
My Carrier: Airtel

Issue in Message Service class in Blackberry Native Cascades

Hi All,

 

I want to send message to a contact using its PIN number.

 

I am ausing blackberry native cascades for development but i cant find any method to send message to contact .

 

I am attaching the code which i have written.

 

#include <bb/cascades/AbstractPane>
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>

#include <bb/platform/bbm/MessageService>

using namespace bb::cascades;

SendMessage::SendMessage(bb::platform::bbm::Context &context, QObject *parent)
    : QObject(parent)
    , m_messageService(0)
    , m_context(&context)
{
}

void SendMessage::sendInvite()
{
    if (!m_messageService) {
        // Instantiate the MessageService.
   m_messageService = new bb::platform::bbm::MessageService(m_context, this);
    }
    // Trigger the invite to download process.
    m_messageService->sendDownloadInvitation();
}

 

After i create object by name m_messageService i cannot get the method to send message to a particular contact.

 

Please help in using this API correctly and sending the message to a particular contact.

 

Thanks & Regards,

Tushar

Retired
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: Issue in Message Service class in Blackberry Native Cascades

Hi,

 

PIN messaging is not part of the bbm packages - look at the classes in and related to AccountService

 

 

When i run this code (and have permissions set )

 

AccountService * as = new AccountService();
QList<Account> accounts(as->accounts(Service::Messages));
for (int i=0; i<accounts.size(); ++i) {
  qDebug() << "Account: " << i << accounts[i].displayName() << accounts[i].id() << accounts[i].provider().name();
}

 i see:

 

Account:  0 "" 199 "Pin to Pin" 
Account:  1 "" 23 "sms-mms" 

 

--
Rob is no longer associated with BlackBerry.