Telling when replication is complete in CouchLite 2.0

I’m trying to detect when replication is complete, and if it worked or not. I’ve gone through several iterations of code like:

        ReplicatorConfiguration replConfig = new ReplicatorConfiguration(database, uri);
        replConfig.setAuthenticator(new SessionAuthenticator(sessionInfo.cookieValue, sessionInfo.cookieDate, sessionInfo.cookieName));
        replConfig.setContinuous(false);
        replConfig.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL);
        replicator = new Replicator(replConfig);
        replicator.addChangeListener(new ReplicatorChangeListener() {
            @Override
            public void changed(Replicator replicator, Replicator.Status status, CouchbaseLiteException error) {
                Log.d("HS", "status "+status.getActivityLevel()+" prog total "+status.getProgress().getTotal()+" prog comp "+status.getProgress().getCompleted()+" error "+error);
                if(error != null) {
                    if (replicatorListener != null) {
                        replicatorListener.onFinished(false);
                    }
                }
                else if (status.getActivityLevel() == Replicator.ActivityLevel.STOPPED && previousLevel != Replicator.ActivityLevel.STOPPED && database.getCount() > 0) {
                    if (replicatorListener != null) {
                        replicatorListener.onFinished(true);
                    }
                }
                previousLevel = status.getActivityLevel();
            }
        });

The problem is that at some point, the status updates stop. I get a status of BUSY with 3/6000 documents completed. Then nothing for 15 minutes. However if I kill the app and restart, it will go to BUSY and then instantly go back to STOPPED state, because it really finished initially within a few seconds.

What language, what platform, what version of Couchbase Lite?
Please include this when you ask a question. It makes a big difference in what the answer is, and who will be able to answer.

This is Android Java, on DP 13 and 14 (I updated to try and fix it). I suspect the problem is in the C++ core though, as it seems those updates bubble up straight from core, and they just stop.

Try turning on Sync logging … (I don’t know the details of configuring logging in Android Couchbase Lite, sorry.) This will dump a lot of internal info from LiteCore about the progress of the sync. You can upload that to gist/pastebin and put a link to it here.

Unfortunately, by default, only errors and warnings are logged. Standardized logging support is not yet available in DB14. It will be supported in DB15 (iOS side) and on DB16(Android)