Android pull replication issue

We have recently added Couchbase Lite 1.0.4 to our Android and iOS mobile apps.
For both we are using continuos replication.
So far we are only using the pull replication and in general it appears to be working well, however we have an issue with our Android app.

Replication from the Couchbase server appears to work as expected most of the time, but if our app is left to run in the background and a change is made on the server, then the app is accessed again after say 10 minutes, the change does not appear to replicate into the app. If the app is restarted, the change will be replicated correctly. In some instances the replication appears to eventually occur after a prolonged wait, but at other times the only way to propagate the change is to restart the app. Between the server change occurring and the android app not replicating, the pull replication status is idle.

Has anyone experienced a similar issue with Android, and if so do you have any suggestions for a solution or a workaround?

Thanks in advance.

Our Couchbase Lite set up;

    protected void initDatabase() throws Exception {

    manager = new Manager(new AndroidContext(this), Manager.DEFAULT_OPTIONS);

    //install a view definition needed by the application
    database = manager.getDatabase(DATABASE_NAME);

    startSync();
}

private void startSync() {
    URL syncUrl;
    try {
        syncUrl = new URL(Global.CB_HOST);
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }

    Authenticator auth = new BasicAuthenticator(Global.CB_USER, Global.CB_PASS);

    Replication pullReplication = database.createPullReplication(syncUrl);
    pullReplication.setContinuous(true);
    pullReplication.setAuthenticator(auth);

    Replication pushReplication = database.createPushReplication(syncUrl);
    pushReplication.setContinuous(true);
    pushReplication.setAuthenticator(auth);

    pullReplication.start();
    pushReplication.start();

    pullReplication.addChangeListener(this);
    pushReplication.addChangeListener(this);

    this.pushReplication = pushReplication;
    this.pullReplication = pullReplication;
}

Hi @agavric,

First of all, I’d highly recommend to use the 1.1 release of Couchbase Lite for Android as it fixes bugs related to the replication you described.

If the problem persists, please let us know and we will discuss further to try to reproduce the issue.

Thanks
James

Hi @jamiltz

Thank you for your prompt reply.

We have now upgraded to the correct Couchbase Lite version, however I can confirm that we are still experiencing the issue.
We have realised that our Sync Gateway is also not the latest version so we’ll be correcting that this morning to see whether that makes a difference.

Please let me know if you have any other suggestions.
In case it helps, I have also added our CB Lite set up code in my original post.

Thanks
Alex

Ok thanks @agavric.

If you experience the same issue after upgrading SG to 1.1 please open an issue on the GitHub repo with the exact steps to help us reproduce it on our end.

Thanks
James

Thanks for your help @jamiltz. We’ll try with SG 1.1 and see whether the issue persists.

Regards
Alex