Working with synced realm objects in Kotlin

I just started to develop an android version of my ios app. For the iOS app I used realm as my remote database service.
I am having trouble understanding how to use synced realm objects with kotlin, hence the kotlin docs only specify how to perform CRUD operations on a locally saved realm file. But what about creating a realm configuration describing a remote realm file?. I was expecting some code snippet like the one below, to also be available for kotlin.

@Octavian_Milea You’ll need to use the Java code for opening a realm along with calling other Sync APIs. We do plan to add a fully native Kotlin SDK but for the time being you’ll need to use Java code in your app until this lands.


Not sure this is correct @Ian_Ward. I have been using Kotlin exclusively for Android and Realm for a long time without problems. You can call any java sdk from Kotlin. And Android studio is actually pretty good at converting java code to Kotlin for you.

@Simon_Persson1 Correct you can call Java APIs from Kotlin. That was what I was trying to say in my response, that you will need to call the Java version of SyncUser.login and getInstance from Kotlin until we have a more “kotlinified” version. Apologies if that was not clear.

1 Like