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()
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() |
String |
getServerCertificateAssetName()
Returns the name of certificate stored under the
assets , to be used to validate
the TLS connection to the Realm Object Server. |
String |
getServerCertificateFilePath()
Returns the name of the certificate copied from
assets into internal storage, so it
can be used to validate the TLS connection to the Realm Object Server. |
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. |
boolean |
shouldWaitForInitialRemoteData()
Returns
true if the Realm will download all known changes from the remote server before being opened the
first time. |
boolean |
syncClientValidateSsl()
Whether the Realm Object Server certificate should be validated in order
to establish a valid TLS connection.
|
String |
toString() |
getCompactOnLaunchCallback, getDurability, getEncryptionKey, getMigration, getPath, getRealmDirectory, getRealmFileName, getRealmObjectClasses, getRxFactory, getSchemaVersion, isReadOnly, 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()
public boolean shouldDeleteRealmOnLogout()
true
if the Realm file must be deleted once the SyncUser
owning it logs out.true
if the Realm file must be deleted if the SyncUser
logs out. false
if the file
is allowed to remain behind.public String getServerCertificateAssetName()
assets
, to be used to validate
the TLS connection to the Realm Object Server.assets
.getServerCertificateFilePath()
public String getServerCertificateFilePath()
assets
into internal storage, so it
can be used to validate the TLS connection to the Realm Object Server.getServerCertificateAssetName()
public boolean syncClientValidateSsl()
true
to validate the remote certificate, or false
to bypass certificate validation.public boolean shouldWaitForInitialRemoteData()
true
if the Realm will download all known changes from the remote server before being opened the
first time.true
if all remote changes will be downloaded before the Realm can be opened. false
if
the Realm can be opened immediately.