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
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone
Accepted Solution

How to detect if message sent or recieved

Hi,

I need to detect if an email message is sent. I have tried to implment folder listener and tried messagefolder.getFolderType()==Folder.SENT but it doesnt work as I am unable to find any .

 

How to get that?

Regards

Rujuta Trivedi
Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to detect if message sent or recieved

Have a look at adding a MessageListener to the Message you want to track.  I use this to delete PIN messages once they have been sent, don't see why this won't work with emails too. 

Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: How to detect if message sent or recieved

Hi,

I had looked at the MessageListener but I didn't find any method for SENT.MessageEvent has parameters like NEW,REPLY,OPENED etc but not SENT.

Can you please help me how to proceed further?

Rujuta Trivedi
Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to detect if message sent or recieved

Good point.  I should have said check the status.  Just to explain, here is a sample method that should delete when the message is trasmitted.

 

        public void changed(MessageEvent e) {

            try {
                Message m = e.getMessage();
                if ( m.getStatus() == Message.Status.TX_SENT ) {
                    // Delete this.....
                    Folder f = m.getFolder();
                    f.deleteMessage(m);
                    MessageToDelete.deleteMessageToDeleteForMessage(m);
                }
            } catch (Exception ex) {
                // As appropriate for your app

            }
        }

Please use plain text.