use couchapp like offline DB
Wed, 10/26/2011 - 03:36
Hallo,
I am Android developer and I work on an application, in which I would use CouchBase. Is there any simple way how to replicate my app with an couchDB server on demand? And my app would use offline documents stored on memory card by default, after I run replication process at first. So my app would use local couchDB on android device and work primary with it. And of course I can start replication by cklicking to refresh button for example.
I hope I described my problem properly and I thank you very much for the answers
Richard Samela
Hello Richard,
The most common pattern used with Couchbase Mobile is to have a database on the mobile device, and use CouchDB replication to synchronize documents between a server in the cloud and the device. Replications are uni-directional by default, but you can start two of them (one each direction) to achieve bi-directional replication. For more information about CouchDB replication, see http://guide.couchdb.org/draft/replication.html
You can trigger a replication on first launch of the app, or you could ship your application with a "seed" database that includes an initial set of documents. And then use replication to update it with the most recent versions. For many applications this results in a better user experience on first launch, because you can display something while the initial replication runs.
Regarding a refresh button, you certainly could offer the user that control. When the user presses the button you would trigger a one-time non-continuous replication to update the databases. However, another alternative is to use continuous replication. In some applications this can provide a better user experience.
marty