Replication for document on Android



So I have a situation where I have to update a document and right after that make a REST API call to the server that will need that updated document.

To make sure that the document was updated remotely I was using a push replication like this:

Database db =  DataStore.getDatabase();
    db.setFilter(SyncManager.REPL_FILTER_BY_CUSTOMER, new ReplicationFilter() {
        public boolean filter(SavedRevision revision, Map<String, Object> params) {
            String nameParam = (String) params.get(KEY_NAME);
            return nameParam != null && nameParam.equals(revision.getProperty(KEY_EMAIL));
    push = db.createPushReplication(new URL(URLSTRING));
    Authenticator auth = AuthenticatorFactory.createBasicAuthenticator(username, password);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(KEY_NAME, customer_email);

    push.addChangeListener(new Replication.ChangeListener() {
        public void changed(Replication.ChangeEvent event) {
            if(push.getStatus() == Replication.ReplicationStatus.REPLICATION_STOPPED){


I was hoping to catch the replication stop to continue with the REST API call?
I’m I looking to the replication mechanism in the wrong way?

Currently I’m getting this error:

E/Sync﹕ com.couchbase.lite.replicator.ReplicationInternal$4@15fc7a99 checkSessionAtPath() response: {authentication_handlers=[default, cookie], ok=true, userCtx={channels={account_*****=*****, public=*****, user_***=*****},}}
E/RemoteRequest﹕ Got error status: 404 for *couchbaseurl*.  Reason: Not Found



Are you adding the database name to the end of URLSTRING? For example if you have a database called “db” on localhost, your url should be http://localhost:4984/db not http://localhost:4984/


I am.
I noticed that the replication filter that I add to the database get null as param. Isn’t that weird?


The error in the message states that the URL cannot be found. What happens if you point your browser at the URL from your error message?