net.rim.device.api.io.messaging
Interface MessageListener


public interface MessageListener

Defines the basic behavior that a class should implement to receive messages. Beware that any UI updates you want to perform should be called using the invokeLater method because the MessageListener does not run in the main event thread.

Also note that applications are allocated a limited number of threads by the platform; if you perform blocking operations that run for a long time in your MessageListener, you may delay delivery of other outstanding messages to your application.

Since:
BlackBerry API 6.0.0

Method Summary
 void onMessage(Destination destination, Message message)
          Called when a message is received.
 void onMessageCancelled(Destination destination, int cancelledMessageId)
          Called if a message is cancelled before delivery.
 void onMessageFailed(Destination destination, MessageFailureException exception)
          Called if message delivery fails due to HTTP errors, network failure, and invalid URL, and so on.
 



Method Detail

onMessage

void onMessage(Destination destination,
               Message message)
Called when a message is received.

Parameters:
destination - The Destination associated with the message received.
message - The message received.
Since:
BlackBerry API 6.0.0

onMessageFailed

void onMessageFailed(Destination destination,
                     MessageFailureException exception)
Called if message delivery fails due to HTTP errors, network failure, and invalid URL, and so on.

Parameters:
destination - The Destination associated with the exception.
exception - Details about the message delivery failure, including a failure response Message if one was provided.
Since:
BlackBerry API 6.0.0

onMessageCancelled

void onMessageCancelled(Destination destination,
                        int cancelledMessageId)
Called if a message is cancelled before delivery. If you want to control which messages are cancellable, you should specifiy that in your message by using the setCancellable method.

Parameters:
destination - The Destination of the cancelled message.
cancelledMessageId - The ID of the cancelled message.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.