public final class SyncConfiguration extends RealmConfiguration
SyncConfiguration is used to setup a Realm that can be synchronized between devices using the Realm
Object Server.
A valid User is required to create a SyncConfiguration. See Credentials and
User.loginAsync(Credentials, String, User.Callback) for more information on
how to get a user object.
A minimal SyncConfiguration can be found below.
SyncConfiguration config = new SyncConfiguration.Builder(context)
.serverUrl("realm://objectserver.realm.io/~/default")
.user(myUser)
.build();
Synchronized Realms only support additive migrations which can be detected and performed automatically, so
the following builder options are not accessible compared to a normal Realm:
deleteRealmIfMigrationNeeded()schemaVersion(long version)migration(Migration)Realm.getInstance(RealmConfiguration) and
Realm.getDefaultInstance() like ordinary unsynchronized Realms.| Modifier and Type | Class and Description |
|---|---|
static class |
SyncConfiguration.Builder
Builder used to construct instances of a SyncConfiguration in a fluent manner.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_FILE_NAME_LENGTH |
static int |
MAX_FULL_PATH_LENGTH |
static int |
PORT_REALM |
static int |
PORT_REALMS |
DEFAULT_REALM_NAME, KEY_LENGTH| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
Session.ErrorHandler |
getErrorHandler() |
URI |
getServerUrl()
Returns the fully disambiguated URI for the remote Realm i.e., the
/~/ placeholder has been replaced
by the proper user ID. |
User |
getUser()
Returns the user.
|
int |
hashCode() |
boolean |
shouldDeleteRealmOnLogout()
Returns
true if the Realm file must be deleted once the User owning it logs out. |
String |
toString() |
getDurability, getEncryptionKey, getMigration, getPath, getRealmDirectory, getRealmFileName, getRealmObjectClasses, getRxFactory, getSchemaVersion, shouldDeleteRealmIfMigrationNeededpublic static final int PORT_REALM
public static final int PORT_REALMS
public static final int MAX_FULL_PATH_LENGTH
public static final int MAX_FILE_NAME_LENGTH
public boolean equals(Object o)
equals in class RealmConfigurationpublic int hashCode()
hashCode in class RealmConfigurationpublic String toString()
toString in class RealmConfigurationpublic User getUser()
public URI getServerUrl()
/~/ placeholder has been replaced
by the proper user ID.URI identifying the remote Realm this local Realm is synchronized with.public Session.ErrorHandler getErrorHandler()