Cloudant continuos replication Android
<p>I'm using IBM Cloudant in my application. In order to connect to my remote db I've used this library : <a href="https://github.com/cloudant/sync-android" rel="nofollow">https://github.com/cloudant/sync-android</a>
. I'm trying to enable the continuous replication in Android, but I'm not able to find a way to enable it. This is the code that I'm using : </p>

<pre><code>File path = getApplicationContext().getDir("datastores", Context.MODE_PRIVATE);
DatastoreManager manager = new DatastoreManager(path.getAbsolutePath());

 try {
        Datastore ds = manager.openDatastore("mydatabase");
        IndexManager indexManager = new IndexManager(ds);  

    URI uri = new URI(myuri);
    // Create a replicator that replicates changes from the remote
    // database to the local datastore.
    Replicator replicator = ReplicatorBuilder.pull().from(uri).to(ds).build();
    // Use a CountDownLatch to provide a lightweight way to wait for completion
    CountDownLatch latch = new CountDownLatch(1);
    Listener listener = new Listener(latch);
    replicator.getEventBus().register(listener);
    replicator.start();
    latch.await();
    replicator.getEventBus().unregister(listener);
    if (replicator.getState() != Replicator.State.COMPLETE) {
        System.out.println("Error replicating FROM remote");
        System.out.println(listener.error);
    }

  } catch (DatastoreException datastoreException) {

    System.err.println("Problem opening datastore: "+datastoreException);

  } catch (Exception documentException) {

    System.err.println("Problem: "+documentException);
}
</code></pre>

<p>and the listener is defined as follow: </p>

<pre><code>private class Listener {
    private final CountDownLatch latch;
    public ErrorInfo error = null;
    public int documentsReplicated;
    public int batchesReplicated;

    Listener(CountDownLatch latch) {
        this.latch = latch;
    }
    @Subscribe
    public void complete(ReplicationCompleted event) {
        this.documentsReplicated = event.documentsReplicated;
        this.batchesReplicated = event.batchesReplicated;
        latch.countDown();
    }
    @Subscribe
    public void error(ReplicationErrored event) {
        this.error = event.errorInfo;
        latch.countDown();
    }
}
</code></pre>

<p>In IOS I'm using a similar code : </p>

<pre><code> CBLReplication *pullReplication = [_cblDatabase createPullReplication:synchronizationURL];

 //THIS IS THE PART THAT I WOULD LIKE TO HAVE IN ANDROID
 pullReplication.continuous = YES;

 [pullReplication start];
</code></pre>

<p>With my code, the remote db is replicated locally on device, but the two db are not synchronized continuously. If I modify something on the cloudant console, the modifications are not propagated to the device (In iOS instead, they are synchronized correctly). </p>

<p>Is there a way to add this option also in Android?</p>