public class SyncManager extends Object
SyncSessions and it is possible to configure session defaults and the underlying
network client using this class.
Through the SyncManager, it is possible to add authentication listeners. An authentication listener will response to events like user logging in or out.
Default error handling for any SyncConfiguration can be added using the SyncManager.
| Modifier and Type | Class and Description |
|---|---|
static class |
SyncManager.Debug
Debugging related options.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
APP_ID
APP ID sent to the Realm Object Server.
|
| Constructor and Description |
|---|
SyncManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAuthenticationListener(AuthenticationListener listener)
Sets a global authentication listener that will be notified about User events like
login and logout.
|
static SyncSession |
getSession(SyncConfiguration syncConfiguration)
Gets any cached
SyncSession for the given SyncConfiguration or create a new one if
no one exists. |
static void |
removeAuthenticationListener(AuthenticationListener listener)
Removes the provided global authentication listener.
|
static void |
setDefaultSessionErrorHandler(SyncSession.ErrorHandler errorHandler)
Sets the default error handler used by all
SyncConfiguration objects when they are created. |
static void |
setUserStore(UserStore userStore)
Set the
UserStore used by the Realm Object Server to save user information. |
public static String APP_ID
public static void setUserStore(UserStore userStore)
UserStore used by the Realm Object Server to save user information.
If no Userstore is specified SyncUser.currentUser() will always return null.userStore - UserStore to use.IllegalArgumentException - if userStore is null.public static void addAuthenticationListener(AuthenticationListener listener)
listener - listener to register.IllegalArgumentException - if listener is null.public static void removeAuthenticationListener(AuthenticationListener listener)
listener - listener to remove.public static void setDefaultSessionErrorHandler(SyncSession.ErrorHandler errorHandler)
SyncConfiguration objects when they are created.errorHandler - the default error handler used when interacting with a Realm managed by a Realm Object Server.public static SyncSession getSession(SyncConfiguration syncConfiguration)
SyncSession for the given SyncConfiguration or create a new one if
no one exists.syncConfiguration - configuration object for the synchronized Realm.SyncSession for the specified Realm.IllegalArgumentException - if syncConfiguration is null.