Notes data on Android mobile ...and offline

Stanislav Marszalek  5 January 2016 10:44:16
How to get data from your Notes database to Android mobiles and use them offline? That was a task which we need to solve in recent days. Users should be able to edit and save their contacts, activities on Android mobiles and then send them back to Notes database. But not only texts, numbers, dates but also images, audio and files. And that all in offline mode as well. On top of that, the application should access mobile’s sensors like location, speed, camera etc. The last point means that we have to create native Android application, so we’ve chosen Android Studio to do the job but how to store data on mobile.
Image:Notes data on Android mobile ...and offline

Where to store data on mobile

You can pick up from several options, how to store your data on mobiles. You can use text files or more obvious choice is SQLite database, in-memory mobile database for storing structured data. But we need to synchronize that data with server, which means write your own code which will handle all synchronization challenges, something like Notes replication and that is not quite easy. That is why we’ve selected Couchbase database which promises to solve that issue.      

Couchbase mobile and Sync Gateway

Couchbase database is like Lotus Notes, no structured database, which stores its data in JSON format. Apart from standard server, it has also mobile version, which can be installed on mobile together with your application. Mobile application stores data in Couchbase Mobile and then replicate them with server part using Sync Gateway. Main replication features:
  • Push and pull replication
  • Replication can start on command or it can be continuous. It means that replication is active whenever user is connected to the internet. For instance, user saves his contact and that change is replicated to the server within seconds.
  • Replication includes not only primitive data but also images, files.
Using Couchbase infrastructure we get data from mobile devices to the Couchbase server, but we still need to move them to Notes databases.
Image:Notes data on Android mobile ...and offline
Java synchronization agent between Couchbase and Notes

For the synchronization purpose we’ve created Java agent in Notes database, which compares modification dates on both sides then compares values of each record and creates, updates or deletes records on specific side. It was not as tricky as one can image. Especially replication conflicts can be avoided by setting up proper permissions, assign which device has higher priority, shortly by set up specific application logic. For Java agent development we’ve use Couchbase Java SDK. Here is a snapshot of Java code:
Image:Notes data on Android mobile ...and offline
Comments

1Patrick Kwinten  16.03.2016 9:23:00  Notes data on Android mobile ...and offline

interesting! would like to know more details how to implement such architecture but I guess the code is protected

2Roblox Mod APK sites  19.05.2018 12:15:32  Notes data on Android mobile ...and offline

You can pick up from several options, how to store your data on mobiles.

3samried  19.05.2018 12:16:52  Notes data on Android mobile ...and offline

Using Couchbase infrastructure we get data from mobile devices to the Couchbase server, but we still need to move them to Notes databases. <a href="{ Link } Mod APK sites</a>

TOPlist