How to Use local realm and sync realm(Realm Object Server) in a single Project?

984 Views Asked by At

I want to use local realm and sync realm(Realm Object Server) in single Android Project. I want to store some data on local realm(that shouldn't be uploaded to Realm Object Server) and some data on Realm Object Server. I am creating two realm objects using two different configuration.

SyncConfiguration config = getROSRealmConfig(user);       
Realm syncRealm = Realm.getInstance(config);

RealmConfiguration config = getRealmConfig(user);      
Realm localRealm = Realm.getInstance(config);

When I storing data on Realm Object Server. It stores data on realm object server along with this It also creates schema of local realm objects on server. Though I am not storing local objects using syncRealm. How to prevent creating of schema of local realm realm object.

1

There are 1 best solutions below

2
On

Why are you using local db with any configuration? Especially one with a user? As per the docs here it is stated that

That configuration—with no options—uses the Realm file default.realm located in Context.getFilesDir.