I have an android app which uses flexible sync configuration for device sync
we first logs into realm then we try to get the realm instance Asynchronously
i create my config as
val config = SyncConfiguration.Builder(realmApp.currentUser())
.waitForInitialRemoteData()
.errorHandler { session, error ->
// do some error handling
Log.e("realmInstanceCreation","failedonconfig")
error.errorMessage?.let { Log.e("realmInstanceCreation", it) }
}
.initialSubscriptions { realm, subscriptions ->
subscriptions.addOrUpdate(
Subscription.create(
"cachereporttypes",
realm.where(cachereporttypes::class.java)
.equalTo("clientId", obj)
)
)
}
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.build()
then i try to get the instance using this configuration as
Realm.getInstanceAsync(config, object : Realm.Callback() {
override fun onSuccess(realm: Realm) {
Log.e("realmInstanceCreation","success")
realmInstance = realm
if (createInstance == 2) {
realmInstance?.close()
realmInstance = null;
}
}
override fun onError(exception: Throwable) {
Log.e("realmInstanceCreation","failed")
super.onError(exception)
}
})
when there is proper internet,device sync set up correctly it works properly by calling onSuccess()
I tried failing the getInstanceAsync by turning of internet,then turning off device Sync,doing schema mismatch error in all 3 places it calls getInstance but neither onSuccess nor onError gets Called