public class SyncConfiguration extends RealmConfiguration
SyncConfiguration
is used to setup a Realm that can be synchronized between devices using the Realm
Object Server.
A valid SyncUser
is required to create a SyncConfiguration
. See SyncCredentials
and
SyncUser.loginAsync(SyncCredentials, String, SyncUser.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.
|
DEFAULT_REALM_NAME, KEY_LENGTH
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
SyncSession.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. |
SyncUser |
getUser()
Returns the user.
|
int |
hashCode() |
boolean |
shouldDeleteRealmOnLogout()
Returns
true if the Realm file must be deleted once the SyncUser owning it logs out. |
String |
toString() |
getDurability, getEncryptionKey, getMigration, getPath, getRealmDirectory, getRealmFileName, getRealmObjectClasses, getRxFactory, getSchemaVersion, shouldDeleteRealmIfMigrationNeeded
public boolean equals(Object o)
equals
in class RealmConfiguration
public int hashCode()
hashCode
in class RealmConfiguration
public String toString()
toString
in class RealmConfiguration
public SyncUser 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 SyncSession.ErrorHandler getErrorHandler()