com.facebook
Enum SessionState

java.lang.Object
  extended by java.lang.Enum<SessionState>
      extended by com.facebook.SessionState
All Implemented Interfaces:
Serializable, Comparable<SessionState>

public enum SessionState
extends Enum<SessionState>

Identifies the state of a Session.

Session objects implement a state machine that controls their lifecycle. This enum represents the states of the state machine.


Enum Constant Summary
CLOSED
          Indicates that the Session was closed normally.
CLOSED_LOGIN_FAILED
          Indicates that the Session is closed, and that it was not closed normally.
CREATED
          Indicates that the Session has not yet been opened and has no cached token.
CREATED_TOKEN_LOADED
           Indicates that the Session has not yet been opened and has a cached token.
OPENED
          Indicates that the Session is opened.
OPENED_TOKEN_UPDATED
           Indicates that the Session is opened and that the token has changed.
OPENING
          Indicates that the Session is in the process of opening.
 
Method Summary
 boolean isClosed()
          Returns a boolean indicating whether the state represents a closed Session that can no longer be used with a Request.
 boolean isOpened()
          Returns a boolean indicating whether the state represents a successfully opened state in which the Session can be used with a Request.
static SessionState valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SessionState[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CREATED

public static final SessionState CREATED
Indicates that the Session has not yet been opened and has no cached token. Opening a Session in this state will involve user interaction.


CREATED_TOKEN_LOADED

public static final SessionState CREATED_TOKEN_LOADED

Indicates that the Session has not yet been opened and has a cached token. Opening a Session in this state will not involve user interaction.

If you are using Session from an Android Service, you must provide a TokenCachingStrategy implementation that contains a valid token to the Session constructor. The resulting Session will be created in this state, and you can then safely call open, passing null for the Activity.


OPENING

public static final SessionState OPENING
Indicates that the Session is in the process of opening.


OPENED

public static final SessionState OPENED
Indicates that the Session is opened. In this state, the Session may be used with a Request.


OPENED_TOKEN_UPDATED

public static final SessionState OPENED_TOKEN_UPDATED

Indicates that the Session is opened and that the token has changed. In this state, the Session may be used with Request.

Every time the token is updated, StatusCallback is called with this value.


CLOSED_LOGIN_FAILED

public static final SessionState CLOSED_LOGIN_FAILED
Indicates that the Session is closed, and that it was not closed normally. Typically this means that the open call failed, and the Exception parameter to StatusCallback will be non-null.


CLOSED

public static final SessionState CLOSED
Indicates that the Session was closed normally.

Method Detail

values

public static SessionState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SessionState c : SessionState.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SessionState valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

isOpened

public boolean isOpened()
Returns a boolean indicating whether the state represents a successfully opened state in which the Session can be used with a Request.

Returns:
a boolean indicating whether the state represents a successfully opened state in which the Session can be used with a Request.

isClosed

public boolean isClosed()
Returns a boolean indicating whether the state represents a closed Session that can no longer be used with a Request.

Returns:
a boolean indicating whether the state represents a closed Session that can no longer be used with a Request.