|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
An object to be used for communication between BlackBerry Messenger contacts.
Sessions have three main states:
STATE_CLOSED: The Session is closed and cannot be used for any sort of communication. To open
a Session, the #sendRequest() method must be invoked. This method will send a request to the MessengerContact
associated with this Session and the state will transition to STATE_REQUESTING.STATE_REQUESTING: A request to open this Session has been sent. This Session cannot
be used for any sort of communication.STATE_OPEN: The Session is open and can be used to send data to the associated
MessengerContact. To close this session, use the close() method.
| Field Summary | ||
|
static int |
STATE_CLOSED
A state variable indicating that this Session is currently open. |
|
static int |
STATE_OPEN
A state variable indicating that this Session is currently closed. |
|
static int |
STATE_REQUESTING
A state variable indicating that a request to open this Session has been sent. |
| Method Summary | ||
|
void |
addListener(SessionListener listener,
ApplicationDescriptor applicaiton)
Adds a SessionListener to this Session. |
|
void |
close()
Closes this Session. |
|
void |
display(String text)
Displays a string in the conversation window for the MessengerContact associated with this Session. |
|
void |
display(String text,
Field field)
Displays a Field object in the conversation window for the MessengerContact associated with this Session. |
|
MessengerContact |
getContact()
Returns the MessengerContact associated with this Session. |
|
int |
getState()
Returns the state of this Session. |
|
boolean |
isOpen()
Whether this Session is open or not. |
|
void |
removeListener(SessionListener listener)
Removes a SessionListener from this Session. |
|
void |
send(Message message)
Sends data to this Session's corresponding MessengerContact |
|
void |
sendRequest(SessionSetupListener listener,
ApplicationDescriptor application,
String url)
Sends a message to this Session's MessengerContact to request that this Session be opened. |
| Field Detail |
public static final int STATE_CLOSED
Session is currently open.public static final int STATE_OPEN
Session is currently closed.public static final int STATE_REQUESTING
Session has been sent.| Method Detail |
public void addListener(SessionListener listener, ApplicationDescriptor applicaiton)
SessionListener to this Session.listener - The listener to be added. If this listener has already been added this method does nothing.applicaiton - An ApplicationDescriptor describing your application. Your application will be started using
the descriptor before notifications are passed to the corresponding listener.IllegalArgumentException - If application is null or does not describe the registering application, or if listener is null.public void close()
Session. Applications will no longer be able to send data using this Session.
The remote user's application will be notified and their corresponding Session will also be closed.public void display(String text)
MessengerContact associated with this Session.text - The text to display in the conversation windowIllegalStateException - If this Session is closed.public void display(String text, Field field)
Field object in the conversation window for the MessengerContact associated with this Session.text - A textual description of the field. To be used as a preview in the contact list screen.field - The Field to display in the conversation window.IllegalStateException - If this Session is closed.public MessengerContact getContact()
MessengerContact associated with this Session.MessengerContact object.public int getState()
Session.Session.public boolean isOpen()
Session is open or not.true if this Session is open, false otherwise.public void removeListener(SessionListener listener)
SessionListener from this Session. If the SessionListener is not already added,
this method does nothing.listener - The listener to be removed.public void send(Message message)
Session's corresponding MessengerContactmessage - A Message containing information to be sent.IllegalStateException - If this Session is closed.public void sendRequest(SessionSetupListener listener, ApplicationDescriptor application, String url)
Session's MessengerContact to request that this Session be opened.
After calling this method the state of this Session will be set to STATE_REQUESTING. If the remote user
accpets the request, the state will be set to STATE_OPEN. If the remote user declines, or if there is another error, the state will return to
STATE_CLOSED.listener - A SessionSetupListener that will be notified of the request's status. Must not be null.application - An ApplicationDescriptor that describes your application. Your application will be started
using the descriptor before any listener events are given to the specified SessionSetupListener.
The application provided must be named uniquely, and the remote contact's device must have already registered an application
with the same unique name with a SessionRequestListener for the request to complete successfully.
url - If the remote user does not have an application on their device that has registered the same unique name as this application,
the URL will be displayed to the remote user. The URL should provide the user the ability to download this application.
url can be null if no URL is needed.
IllegalStateException - If this Session is in the STATE_REQUESTING state.IllegalArgumentException - If listener is null, if application is null or if application does not describe the calling application
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2007 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.