interface IO2GSessionStatus

Brief

The interface provides method signatures to process notifications about session status changes and login failures.

Details

The interface must be implemented by an application in order to process status changes of a session object.

When a user tries to login, the session status changes to CONNECTING.

If a login fails, the status changes to DISCONNECTED and the server returns an error message explaining why the login has failed. If you want to capture what has gone wrong, use the onLoginFailed method of the interface.

If a login is successful, the session status changes to CONNECTED. If you want to capture and process every status change of the session object, use the onSessionStatusChanged method of the interface. For a complete list of the session statuses, see O2GSessionStatusCode. For a detailed explanation of the session statuses, refer to the Session Statuses section.

If you want to use the methods of the IO2GSessionStatus interface, you must create a class that implements the interface. For example,
public class SessionStatusListener implements IO2GSessionStatus { }

An instance of the class implementing the IO2GSessionStatus interface must be subscribed to the session object before calling the O2GSession.login method. It is accomplished by calling the O2GSession.subscribeSessionStatus method. For example,

mSession = O2GTransport.createSession();
SessionStatusListener statusListener = new SessionStatusListener(mSession, mDBName, mPin);
mSession.subscribeSessionStatus(statusListener);

The subscribed instance must be unsubscribed from the session object after calling the O2GSession.logout method, but before calling the O2GSession.dispose method. It is accomplished by calling the O2GSession.unsubscribeSessionStatus method. For example,

mSession.logout();
mSession.unsubscribeSessionStatus(statusListener);
mSession.dispose();

For the interface implementation details, see the example below.

Example

Process notifications about session status changes and a login failure [show]

The namespace is com.fxcore2.

Public Methods

onLoginFailed

Processes a notification about a login failure.

onSessionStatusChanged

Processes notifications about session status changes.

back