I have some realmObject(my data model) in my android app and some Sync Realm for example:
realm_url1 = "realm://myserver:9080/~/setting contain some user setting realmObject
realm_url2 = "realm://myserver:9080/~/app contain some app realmObject
How i can set what object create in what realm_url? because all of my realmObject has created in all realm_url. I getInstance to __permission realm to read user permission but all of my realm object create there and __permission not work properly again and i can't restore it to back. Please get me know can separate object is realms.
If you want to create a separate schema for each Realm, you can do so by using the @RealmModule
annotation. You can see how to use it here: https://realm.io/docs/java/latest/#schemas
// Create the module
@RealmModule(classes = { Person.class, Dog.class })
public class MyModule {
}
// Set the module in the RealmConfiguration to allow only classes defined by the module.
SyncConfiguration config = new SyncConfiguration.Builder(user, url)
.modules(new MyModule())
.build();
// It is possible to combine multiple modules to one schema.
SyncConfiguration config = new SyncConfiguration.Builder(user, url)
.modules(new MyModule(), new MyOtherModule())
.build();