Moreover, we got aware of Couchbase Sync Gateway in this article for synchronizing data with ease across all our apps installations. With this post I want to finally show you those technologies in action!
The contacts app with Couchbase Lite
For the sake of this series, we developed a sample application for both iOS and Android. This app allows you to create your personal address book with all your contacts, and sync it in real time across all your devices which have the app installed. Contacts are persisted using Couchbase Lite, as we have seen in the previous post. Thanks to the fact that the data are actually saved into the database and not explicitly sent to a remote server, we can work in absence of network without any sort of problems. This ensures a full offline user experience, with no potential lags due to a slow connectivity or any kind of network failures. All the replication is made possible out-of-the-box by the Couchbase library.
Opening the sample app, you will see the list of all the contacts you added into your synced address book. You can add a new contact by pressing the “+” button. Also, by clicking on a list item you can edit the contact info as you prefer. Eventually, you can delete a contact directly from the contacts list.
Demonstration of Couchbase Lite
Works like a charm! You can find all the application sources in our GitHub repositories:
- Android: https://github.com/MOLO17/couchbase-contacts-android
- iOS: https://github.com/MOLO17/couchbase-contacts-ios
As mentioned in the readme files, you need a running Couchbase Server and Couchbase Sync Gateway instances for replicating data. If you don’t have such instances up and running, you may want to have a look at my previous blog post! Let’s setup them on the fly!
That’s all, thanks for reading and stay tuned for more!