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
dans
Posts: 20
Registered: ‎11-17-2010
My Device: Dev Alpha A
Accepted Solution

Messages Sample not showing BBM messages

[ Edited ]

Question:

I'm using the Cascades PIM Messages Sample. ( Download , Doc
 
Should it list BBM messages?
 
Details:
It is showing Email conversations just fine. 
I had expected to find BBM messages under the account: "No Name (Pin to Pin)" but no messages are listed there.
BBM itself is working fine and I can send/receive messages. So I know that there is a chat conversation.
 
My Device: Dev Alpha A - No SIM inserted
SDK: Latest Native SDK 10.0.9.2318
 
What I have tried already:
adding various permissions to he original unmodified sample
 
Thanks,
Daniel
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Messages Sample not showing BBM messages

This is expected.  The API does not allow you to capture BBM messages (no other API for this either).  

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.
New Contributor
vlada
Posts: 5
Registered: ‎12-16-2012
My Device: none

Re: Messages Sample not showing BBM messages

Will API to access this be available in the future and when? Is there a special reason why BBM messages are not available?

 

I'm also noticing a similar behaviour for SMS. Are SMS messages not available as well?

Please use plain text.
Developer
KlausNahr
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook

Re: Messages Sample not showing BBM messages

Same problem for me. I tried to read SMS messages, but no success. No SMS Messages, no SMS Folders, no SMS Conversations.

Klaus Nahr
Please use plain text.
Developer
KlausNahr
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook

Re: Messages Sample not showing BBM messages

Hi,

 

i fixed the samples app to view and filter SMS/MMS too.

 

At first you have to enable the "Text Messages" Permission in bar-descriptor.xml.

 

In messages.cpp add:

 

#include <bb/pim/message/MessageFilter>

and change filterMessages() to:

 

void Messages::filterMessages()
{
    if (!m_currentAccount.isValid())
        return;

    QList<Message> messages;
    bool isSMS_MMS = m_currentAccount.provider().name() == "sms-mms";

    if (isSMS_MMS  &&  m_filter.isEmpty())
    {
        MessageFilter filter;
        messages = m_messageService->messages(m_currentAccount.id(), filter);
    }
    else
    {
        MessageSearchFilter filter;
        // Use the entered filter string as search value
        filter.addSearchCriteria(SearchFilterCriteria::Any, m_filter);
        messages = m_messageService->searchLocal(m_currentAccount.id(), filter);
    }

    // Clear the old message information from the model
    m_model->clear();

    // Iterate over the list of message IDs
    foreach (const Message &message, messages) {
        // If SMS or MMS show only inbound messages
        if (!isSMS_MMS  ||  message.isInbound())
        {
            // Copy the data into a model entry, for SMS/MMS show Body, otherwise Subject
            QVariantMap entry;
            entry["messageId"] = message.id();
            entry["subject"] = isSMS_MMS ? message.body(MessageBody::smileytongue:lainText).plainText() : message.subject();
            entry["time"] = message.serverTimestamp().toString();

            // Add the entry to the model
            m_model->insert(entry);
        }
    }
}

 

The problem is with searchLocal(). It will not return any SMS/MMS message if the filter is empty. Therefore I am calling messages() if the filter is empty. If you change the SearchFilterCriteria to anything else than Any, the filter does not return any result for SMS/MMS. Seems to be another bug.

 

Inbound and Outbound SMS messages are in one box, thats why I am checking message.isInbound() before adding a SMS message to the list.

 

SMS message do not have a subject, thats why I am showing the body in the list.

Klaus Nahr
Please use plain text.