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;
}