Unable to Get Synced Data From Cloud


#1

For some reason, I am not able to fetch my data from Realm Cloud. I can see the data is added via Realm Studio but I can’t fetch it back in my Android app.

I am using the most recent client version v 5.3.1. I can see that the realms that I am fetching are owned by the correct owner that I logged in with on the client (see screenshot). And I use the same SyncConfiguration to write and read like this

 public void setUpRealm() {
        String url = "realms://xxxxxx.us1.cloud.realm.io/~/journal";
        SyncConfiguration configuration = SyncUser.current()
                .createConfiguration(url)
                .build();
        realm = Realm.getInstance(configuration);
    }

Is there anything I am missing to implement basic sync? I am using the good all findAll api like this?

 public RealmResults<Folder> getAllFolders() {
        RealmResults<Folder> folders = realm.where(Folder.class).findAll();
        return folders;
    }

Realm Studio Screenshot
Realm Studio Screenshot 2


#2

I guess you’re using partial realm, right? So probably subscription is missed. So for example something like that in your case

 public void setUpRealm() {
        String url = "realms://xxxxxx.us1.cloud.realm.io/~/journal";
        SyncConfiguration configuration = SyncUser.current()
                .createConfiguration(url)
                .build();
        realm = Realm.getInstance(configuration);

        subscription = realm.All<Folder>().Subscribe();
    }

 public IList <Folder> getAllFolders() {
        //RealmResults<Folder> folders = realm.where(Folder.class).findAll();
        IList<Folder> folders = subscription.Result.All();
        return folders;
    }


#3

Thanks @Radek but I am not using Partial Realm and I have no need to do so, I just want each user to sych all their data. There is no public or shared Realm. Thanks for the feedback though.


#4

I believe using SyncUser.current().createConfiguration() will default to a query-based sync configuration. Looking at the Java docs, you need to explicitly opt-in for full synchronization.


#5

Thanks @nirinchev that was the issue, I totally missed that part of the documentation.