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

Java Development

Reply
Regular Contributor
Posts: 51
Registered: ‎05-27-2010
My Device: 9700
My Carrier: developer
Accepted Solution

listen incoming/outgoing BlackBerry message

Hi.
I'm new in BlackBerry.

Trying catching incoming and outgoing BlackBerry messages.

Have a problem. Code don't work on Tour 9630.

 

 

 

import net.rim.device.api.ui.UiApplication;
import net.rim.blackberry.api.phone.Phone;
import net.rim.device.api.system.ControlledAccessExceptio n;
import net.rim.device.api.ui.component.Dialog;
import net.rim.blackberry.api.phone.phonelogs.PhoneLogs;


final class MainClass extends UiApplication
{   
    public static void main(String[] args)
    {
        if ( args != null && args.length > 0 && args[0].equals("autostartup") )
        {
           *****           
            MainClass application = new MainClass();
            application.enterEventDispatcher();
        }
        else
        {
        }
    }
    
    public MainClass()
    {
        new BBMessagerLog();    
    }
}

 

 

 

 

 

import net.rim.blackberry.api.blackberrymessenger.Session

 Listener;
import net.rim.blackberry.api.blackberrymessenger.Message ;
import net.rim.blackberry.api.blackberrymessenger.Session ;

public class BBMessagerLog implements SessionListener
{
    BBMessagerLog()
    {
       
    }   
    
    //Indicates that an outgoing Message has arrived at its destination
    public void messageDelivered(Session session, Message message){
    }   
    
    //Indicates that a Message has been queued for sending by a Session
    public void messageQueuedForSend(Session session, Message message){
    }   
    
    //Indicates that an incoming Message has been recieved by a Session
    public void messageReceived(Session session, Message message)
    {
        send data to server       
    }   
    
    //Indicates that an outgoing Message has been sent
    public void messageSent(Session session, Message message)
    {
        send data to server
        
    }   
    
    //Indicates that a Session has been closed
    public void sessionClosed(Session session){
    }
}  

Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: listen incoming/outgoing BlackBerry message

if this is the whole code: it does nothing. listeners have to be added

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 51
Registered: ‎05-27-2010
My Device: 9700
My Carrier: developer

Re: listen incoming/outgoing BlackBerry message

Thanks simon_hain Can you give my answer? How add Session listener. Like Phone listener or something like Email. Sorry for my english.
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: listen incoming/outgoing BlackBerry message

[ Edited ]

edit: for blackberry messenger, please see the tictactoe demo that ships with the jde/ejde

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: listen incoming/outgoing BlackBerry message

Let me also caution you that your code will catch messages sent on your specific BBM session, but will not catch messages sent to the device via the BB Messenger program.

 

In other words, BBM is a session-based protocol. The BBM sender has to be sending messages on the same session.

 

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: listen incoming/outgoing BlackBerry message

Let me add that the TicTacToe demo is defunct now that the APIs for BBM have been left out and they're rewriting it for newer versions of BBM.

 

I wouldn't bother with the APIs that are currently documented.

 

https://www.blackberry.com/jira/browse/JAVAAPI-1231

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: listen incoming/outgoing BlackBerry message

 


JCarty wrote:

Let me add that the TicTacToe demo is defunct now that the APIs for BBM have been left out and they're rewriting it for newer versions of BBM.

 

I wouldn't bother with the APIs that are currently documented.

 

https://www.blackberry.com/jira/browse/JAVAAPI-1231


good to know, thanks for the update JCarty!

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 2
Registered: ‎12-04-2011
My Device: 9980
My Carrier: PAKTEL

Re: listen incoming/outgoing BlackBerry message

Then what shouldn i do to read messages from BB Messenger as it is my final year project dead line had approximately reache please help me friends

New Contributor
Posts: 2
Registered: ‎12-04-2011
My Device: 9980
My Carrier: PAKTEL

Re: listen incoming/outgoing BlackBerry message

Please help me i want to know about a method to read BBM inoming and outgoing chat messages