Constructor Detail

Builder

public Builder()

Creates an instance of the Builder for the RealmConfiguration.

This will use the app's own internal directory for storing the Realm file. This does not require any
additional permissions. The default location is /data/data/<packagename>/files, but can
change depending on vendor implementations of Android.

schemaVersion

Sets the schema version of the Realm. This must be equal to or higher than the schema version of the existing
Realm file, if any. If the schema version is higher than the already existing Realm, a migration is needed.

deleteRealmIfMigrationNeeded

Setting this will change the behavior of how migration exceptions are handled. Instead of throwing a
RealmMigrationNeededException the on-disc Realm will be cleared and recreated
with the new Realm schema.

This cannot be configured to have an asset file at the same time by calling
assetFile(String) as the provided asset file will be deleted in migrations.

inMemory

Setting this will create an in-memory Realm instead of saving it to disk. In-memory Realms might still use
disk space if memory is running low, but all files created by an in-memory Realm will be deleted when the
Realm is closed.

Note that because in-memory Realms are not persisted, you must be sure to hold on to at least one non-closed
reference to the in-memory Realm object with the specific name as long as you want the data to last.

modules

Replaces the existing module(s) with one or more RealmModules. Using this method will replace the
current schema for this Realm with the schema defined by the provided modules.

A reference to the default Realm module containing all Realm classes in the project (but not dependencies),
can be found using Realm.getDefaultModule(). Combining the schema from the app project and a library
dependency is thus done using the following code: