This interface is used to determine if a Realm file should be compacted the first time the file is opened and before the instance is returned.

Note that compacting a file can take a while, so compacting should generally only be done as part of opening a Realm on a background thread.


Link copied to clipboard
abstract fun shouldCompact(totalBytes: Long, usedBytes: Long): Boolean

This method determines if the Realm file should be compacted before opened and returned to the user.