question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Realm.getInstanceAsync callbacks does not get called, when new user created on realm-server

See original GitHub issue

Goal

create new synced user on realm-server and receive callback

Expected Results

Either of onSuccess() or onError() methods must be called after first sync.

Actual Results

Neither of onSuccess() or onError() methods does not get called after first sync. Overrided onSuccess() does get called only after same actions, but with synced user present on realm-server (on second app launch).

Steps & Code to Reproduce

  1. Remove synced user from realm-server (if has one);
  1. Trying to sync same user again from device with Realm.getInstanceAsync(syncConfiguration, new Realm.Callback() {});

Code Sample


> final SyncConfiguration syncConfiguration = new SyncConfiguration.Builder(user, DBHelper.getServerURL()).disableSSLVerification().waitForInitialRemoteData().build();
        Realm.getInstanceAsync(syncConfiguration, new Realm.Callback() {

            @Override
            public void onError(@NonNull Throwable exception) {
                super.onError(exception);
                onFinished(exception.getMessage());
            }

            @Override
            public void onSuccess(@NonNull Realm realm) {
                Realm localRealm = Realm.getDefaultInstance();
                realm.beginTransaction();
                realm.copyToRealmOrUpdate(localRealm.where(ModelFolder.class).findAll());
                realm.copyToRealmOrUpdate(localRealm.where(ModelTrack.class).findAll());
                realm.copyToRealmOrUpdate(localRealm.where(ModelBookmark.class).findAll());
                realm.commitTransaction();
                realm.close();
                localRealm.close();
                AppSettings.setSyncMode(syncMode);
                DBHelper.updateDefaultConfiguration(syncConfiguration);
                onFinished(null);
            }
        });

Version of Realm and tooling

Realm version(s): io.realm:realm-gradle-plugin:4.0.0-RC1 realm-server:2.0.0-RC2

Realm sync feature enabled: yes

Android Studio version: 2.3.3

Which Android version and device: Api 15+

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
beeendercommented, Oct 18, 2017
0reactions
beeendercommented, Oct 20, 2017

@molind Please let us know if it still doesn’t work the latest ROS.

I am closing this issue for now. Feel free to reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realm.getInstanceAsync doesn't get called for the first time on ...
I now start the app, the 'Realm.getInstanceAsync(config, callback) never gets called — obviously as there is a conflict between local-realm ...
Read more >
Realm sync not working after reconnecting to the internet
I have a trouble on sync with realm object server when user connects to the object server (login), than switch Internet Off, adds...
Read more >
Realm Xamarin 2.0.0 - AWS
Realm Xamarin is the first database built for mobile. An alternative to SQLite and ORMs that's fast, easy to use, and open source....
Read more >
SyncConfiguration.java example - Javatips.net
Callback )} for more information on * how to get a user object. ... canWrite()) { throw new IllegalArgumentException("Realm directory is not writable:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found