Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Class AppConfiguration.Builder

On this page

  • io.realm.mongodb
  • Constructors
  • Method Summary
  • Inherited Methods
  • Constructor Detail
  • Method Detail
  • addCustomRequestHeader
  • addCustomRequestHeaders
  • appName
  • appVersion
  • authorizationHeaderName
  • baseUrl
  • build
  • codecRegistry
  • defaultClientResetHandler
  • defaultSyncClientResetStrategy
  • defaultSyncErrorHandler
  • encryptionKey
  • httpLogObfuscator
  • requestTimeout
  • syncRootDirectory
io.realm.mongodb.AppConfiguration.Builder

Enclosing class:

AppConfiguration

Builder used to construct instances of a AppConfiguration in a fluent manner.

Constructor and Description
String appId
)

Creates an instance of the Builder for the AppConfiguration.

Modifier and Type
Method and Description
String headerName,
String headerValue
)

Adds an extra HTTP header to append to every request to a Realm Object Server.

Adds extra HTTP headers to append to every request to a Realm Object Server.

String appName
)

Sets the apps name.

String appVersion
)

Sets the apps version.

Sets the name of the HTTP header used to send authorization data in when making requests to MongoDB Realm.

String baseUrl
)

Sets the base url for the MongoDB Realm Application.

Creates the AppConfiguration.

CodecRegistry codecRegistry
)

Set the default codec registry used to encode and decode BSON arguments and results when calling remote Realm io.realm.mongodb.functions.Functions and accessing a remote io.realm.mongodb.mongo.MongoDatabase .

Sets the default Client Reset handler used by Synced Realms when they report a Client Reset.

Sets the default sync client reset strategy used by Synced Realms when they report a Client Reset.

Sets the default sync client reset strategy used by Synced Realms when they report a Client Reset.

Sets the default error handler used by Synced Realms when reporting errors with their session.

byte[] key
)

Sets the encryption key used to encrypt user meta data only.

Sets the HttpLogObfuscator used to keep sensitive information in HTTP requests from being displayed in the logcat.

long time,
)

Sets the default timeout used by network requests against the MongoDB Realm application.

Configures the root folder containing all files and Realms used when synchronizing data between the device and MongoDB Realm.

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public Builder (
String appId
)

Creates an instance of the Builder for the AppConfiguration.

Parameters

  • appId - the application id of the MongoDB Realm Application.

Adds an extra HTTP header to append to every request to a Realm Object Server.

Parameters

  • headerName - the name of the header.

  • headerValue - the value of header.

Throws

Adds extra HTTP headers to append to every request to a Realm Object Server.

Parameters

  • headers - map of (headerName, headerValue) pairs.

Throws

Sets the apps name. This is only used as part of debug headers sent when making network requests at the MongoDB Realm application.

Parameters

  • appName - app name used to identify the application.

Sets the apps version. This is only used as part of debug headers sent when making network requests at the MongoDB Realm application.

Parameters

  • appVersion - app version used to identify the application.

Sets the name of the HTTP header used to send authorization data in when making requests to MongoDB Realm. The MongoDB server or firewall must have been configured to expect a custom authorization header.The default authorization header is named DEFAULT_AUTHORIZATION_HEADER_NAME.

Parameters

  • headerName - name of the header.

Throws

Sets the base url for the MongoDB Realm Application. The default value is DEFAULT_BASE_URL.

Parameters

  • baseUrl - the base url for the MongoDB Realm application.

Creates the AppConfiguration.

Returns

the AppConfiguration that can be used to create a App .

CodecRegistry codecRegistry
)

Set the default codec registry used to encode and decode BSON arguments and results when calling remote Realm io.realm.mongodb.functions.Functions and accessing a remote io.realm.mongodb.mongo.MongoDatabase .

Will default to DEFAULT_BSON_CODEC_REGISTRY if not specified.

Parameters

  • codecRegistry - The default codec registry for the App.

Tip

See also:

  • DEFAULT_BSON_CODEC_REGISTRY

  • Builder.getDefaultCodecRegistry()

Sets the default Client Reset handler used by Synced Realms when they report a Client Reset. session.This default can be overridden by calling io.realm.mongodb.sync.SyncConfiguration.Builder.clientResetHandler(SyncSession.ClientResetHandler) when creating the io.realm.mongodb.sync.SyncConfiguration .

Parameters

  • handler - the default Client Reset handler.

Sets the default sync client reset strategy used by Synced Realms when they report a Client Reset. session.This default can be overridden by calling io.realm.mongodb.sync.SyncConfiguration.Builder.syncClientResetStrategy(ManuallyRecoverUnsyncedChangesStrategy) or io.realm.mongodb.sync.SyncConfiguration.Builder.syncClientResetStrategy(DiscardUnsyncedChangesStrategy) when creating the io.realm.mongodb.sync.SyncConfiguration .

Parameters

  • strategy - the default sync client reset strategy.

Sets the default sync client reset strategy used by Synced Realms when they report a Client Reset. session.This default can be overridden by calling io.realm.mongodb.sync.SyncConfiguration.Builder.syncClientResetStrategy(ManuallyRecoverUnsyncedChangesStrategy) or io.realm.mongodb.sync.SyncConfiguration.Builder.syncClientResetStrategy(DiscardUnsyncedChangesStrategy) when creating the io.realm.mongodb.sync.SyncConfiguration .

Parameters

  • strategy - the default sync client reset strategy.

Sets the default error handler used by Synced Realms when reporting errors with their session.This default can be overridden by calling io.realm.mongodb.sync.SyncConfiguration.Builder.errorHandler(SyncSession.ErrorHandler) when creating the io.realm.mongodb.sync.SyncConfiguration .

Parameters

  • errorHandler - the default error handler.

Sets the encryption key used to encrypt user meta data only. Individual Realms needs to use io.realm.mongodb.sync.SyncConfiguration.Builder.encryptionKey(byte[]) to make them encrypted.

Parameters

  • key - a 64 byte encryption key.

Throws

Sets the HttpLogObfuscator used to keep sensitive information in HTTP requests from being displayed in the logcat.

If left unspecified, it will default to obfuscating HTTP login requests.

Parameters

  • httpLogObfuscator - the default HTTP log obfuscator for the app.

Sets the default timeout used by network requests against the MongoDB Realm application. Requests will terminate with a failure if they exceed this limit. The default value is AppConfiguration.DEFAULT_REQUEST_TIMEOUT seconds.

Parameters

  • time - the timeout value for network requests.

  • unit - the unit of time used to define the timeout.

Configures the root folder containing all files and Realms used when synchronizing data between the device and MongoDB Realm.The default root dir is Context.getFilesDir()/mongodb-realm .

Parameters

  • rootDir - where to store sync related files.

← Class AppConfiguration