Skip to content

Instantly share code, notes, and snippets.

@michaelbukachi
Created May 8, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbukachi/51bca37194ea8e69b349bb2aa357d0b6 to your computer and use it in GitHub Desktop.
Save michaelbukachi/51bca37194ea8e69b349bb2aa357d0b6 to your computer and use it in GitHub Desktop.
Get realm instance
fun getRealm(context: Context): Realm {
try {
Realm.init(get())
} catch (e: Exception) {
}
val config = RealmConfiguration.Builder()
.schemaVersion(1)
.migration(Migration())
.build()
return Realm.getInstance(config)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment