Package io.realm.mongodb.sync
Enum SyncSession.State
- java.lang.Object
-
- java.lang.Enum<SyncSession.State>
-
- io.realm.mongodb.sync.SyncSession.State
-
- All Implemented Interfaces:
Serializable
,Comparable<SyncSession.State>
- Enclosing class:
- SyncSession
public static enum SyncSession.State extends Enum<SyncSession.State>
Enum describing the states a SyncSession can be in. The initial state isINACTIVE
.A Realm will automatically synchronize data with the server if the session is either
ACTIVE
orDYING
andSyncSession.isConnected()
returnstrue
.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ACTIVE
The Realm is open and data will be synchronized between the device and the server if the underlying connection isConnectionState.CONNECTED
.DYING
The Realm was closed, but still contains data that needs to be synchronized to the server.INACTIVE
This is the initial state.WAITING_FOR_ACCESS_TOKEN
The user is attempting to synchronize data but needs a valid access token to do so.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SyncSession.State
valueOf(String name)
Returns the enum constant of this type with the specified name.static SyncSession.State[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INACTIVE
public static final SyncSession.State INACTIVE
This is the initial state. The session is closed. No data is being synchronized. The session will automatically transition toACTIVE
when a Realm is opened.
-
ACTIVE
public static final SyncSession.State ACTIVE
The Realm is open and data will be synchronized between the device and the server if the underlying connection isConnectionState.CONNECTED
.The session will remain in this state until the Realm is closed. In which case it will become
DYING
.
-
DYING
public static final SyncSession.State DYING
The Realm was closed, but still contains data that needs to be synchronized to the server. The session will attempt to upload all local data before goingINACTIVE
.
-
WAITING_FOR_ACCESS_TOKEN
public static final SyncSession.State WAITING_FOR_ACCESS_TOKEN
The user is attempting to synchronize data but needs a valid access token to do so. Realm will either use a cached token or automatically try to acquire one based on the current users login. This requires a network connection.Data cannot be synchronized in this state.
Once a valid token is acquired, the session will transition to
ACTIVE
.
-
-
Method Detail
-
values
public static SyncSession.State[] 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 (SyncSession.State c : SyncSession.State.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SyncSession.State 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 nameNullPointerException
- if the argument is null
-
-