The first time I open my app on a new device (and every subsequent open) I login, build and open my realm collections. Here is the code for one collection, I do open multiple connections but do it asynchronously
val user = login()
// create a SyncConfiguration
val logedintime = System.currentTimeMillis() - startTime
println("Log in time taken: $logedintime ms")
// Items
val config = SyncConfiguration.Builder(user, setOf(item::class))
.waitForInitialRemoteData(600.seconds)
.initialSubscriptions { realm ->
add(
realm.query<item>(),
"items"
)
}
.build()
val buildtime = System.currentTimeMillis() - startTime
println("build realm time taken: $buildtime ms")
itemRealm = Realm.open(config)
val opentime = System.currentTimeMillis() - startTime
println("open realm time taken: $opentime ms")
Log.v("realmPlugin","Successfully opened realm: ${itemRealm.configuration}")
Every first time this process runs it never succesfully opens the connections. I get the following error: REALM W [Core] Reading failed: End of input
However If I shut my app and run it again it will always work on subsequent opens.
Any ideas of what could cause this or how I can fix this issue?