Now Accepting Apple Pay

Apple Pay is the easiest and most secure way to pay on StudyMoose in Safari.

Mobile App Offline Data Synchronization

I believe that it is essential for developers to understand the synchronize mechanism since a client can go offline and you will need to think about the reconciliation of this data. When adding the synchronizing capability to your application, you can reduce the limitation of access to your application.

For example, In my mobile the weather application cannot work when its offline or when it is in the airplane mode, and the data is not synced as it is preferred, but if you have the ability to synchronize your offline application data, then the weather application can get the latest up to date weather information even when network connection is not available.

Developers may think of the synchronizing mechanism with an offline capability as a time-consuming mechanism, and that its benefit is not worth the investment. However, as stated in previous example it is an important feature and it is not expensive to adapt to your application, and also being offline should not be an error condition.

Get quality help now
KarrieWrites
Verified writer

Proficient in: Computers

5 (339)

“ KarrieWrites did such a phenomenal job on this assignment! He completed it prior to its deadline and was thorough and informative. ”

+84 relevant experts are online
Hire writer

I have done several kinds of researches to find ways and technologies to establish data synchronization and I came up with two common ways to do it.

The first way is with the help of Kinto technology, which is a generic JSON document store with synchronization and sharing capabilities. Kinto will keep the local database up to date with the Kinto server, and the remote changes perform to the local data, and local changes are uploaded using headers to control concurrency and overwrite [1].

The second way that I choose for my final project is with the use of CouchDB, PouchDB and IBM Cloudant service, PouchDB will store data locally and when there is network connection it will start synchronizing to CouchDB with IBM Cloudant service to securely host the data.

Get to Know The Price Estimate For Your Paper
Topic
Number of pages
Email Invalid email

By clicking “Check Writers’ Offers”, you agree to our terms of service and privacy policy. We’ll occasionally send you promo and account related email

"You must agree to out terms of services and privacy policy"
Check writers' offers

You won’t be charged yet!

I choose the second way since I was able to find more researches and information about it online, also because I struggled with configuring and implementing Kinto to my application, to that end I continued with the combination of PouchDB and CouchDB as it was a more widely used way to perform synchronization.

For my project, I have built an offline-first mobile application called Fitness with the use of Ionic framework; this application mainly focuses on adding your workouts data and enables you to review the analysis of your overall workouts.

The application works when you are offline as the data is locally stored until you reconnect again, and the application can work from any device since it has the offline capability and the sync mechanism. Later on, I will include all the details and analysis I have configured to complete this project.

2

2 Comparative Literature Survey

Daniel Sauble gives a great example about offline-first applications on his book “Offline First Web Development”, he stated that a VP designer called Susan is responsible for the company’s product design, development, marketing, sales, and others. Susan uses a simple to-do application to store all her lists to organizing everything in her life. Unfortunately, this app behaves poorly when it goes offline. When the internet connection goes down her to-do list fails to load, she doesn’t have confidence that her list is created on her other devices, the app shows scary messages that make her think she lost some data. When Susan has an important thing to write she usually takes fifteen minutes of work, but one day her conference’s WI-FI connection was bad, she continued writing and a few minutes later her to-do list app crashes and Susan loses all her work [2].

CouchDB is an open-source NoSQL database that can store data with JSON (JavaScript Object Notation) documents distributed under the Apache license, if you want to access the documents then it is done via and to distribute the data efficiently it is done with CouchDB’s incremental replication [3]. A CouchDB server hosts databases that store documents, and each document has a unique name in the database and for reading and updating the database documents, CouchDB provides a RESTful API [3].

I choose CouchDB over other different databases like PostgreSQL or MySQL instead, because of the and sync mechanism. CouchDB communicates with the database directly from the client-side of the app with the use of also CouchDB is a cover from the bottom-up to enable easy synchronization between different devices and databases [4].

PouchDB is an open-source JavaScript database inspired directly by CouchDB, and the goal of PouchDB is to emulate the CouchDB API with near-perfect fidelity while running on the client side of the browser or in Node.js [4]. PouchDB is one technology that lets you build apps that store data in the front-end and synchronize its data in the backend. Therefore, PouchDB is a database that can run locally in your browser with the ability to synchronize with the back-end automatically, which means the data will be sent and stored from the front-end to the back-end until it is synchronized with other clients.

IBM Cloudant is an open-source JSON (JavaScript Object Notation) database based on Apache CouchDB. It is different from the traditional databases since all replicas of your data are available for both reads and write, Cloudant and CouchDB share a common replication protocol that lets you synchronize copies of your Cloudant data to remote CouchDB instance in a push of a button [5]. On Cloudant, if you want to connect to a remote database, then you can use PouchDB as a client library to CouchDB by specifying the actual URL of your database to your Cloudant account, and if you have the appropriate permission it would create that database or just reference it as already exist.

Ionic Framework is an open source UI toolkit for building mobile applications using web technologies like HTML, CSS, and JavaScript [6]. Ionic Framework is easy to learn and it focuses on the frontend user experience. It integrates easily with other frameworks and libraries such as Angular. Furthermore, Ionic can build apps for different devices such as Android, iOS, and desktop. It has a clean and simple code structure.

3

In my project, the greatest challenge was to perform replication and synchronization with PouchDB with CouchDB or Cloudant to the mobile application data. The main advantage of CouchDB and Cloudant is its ability to replicate the local data storage serving data once the connection is available, and being offline requires synchronization of data when a connection is available. Synchronicity and replication is the process of sharing information between multiple redundant storage sources. Documents in Cloudant are stored in a single structure of JSON format; this format simplifies the complex structure of objects, fields, arrays, and scalable types. Then, they are combined into a simple document record. Furthermore, there are several classifications of NoSQL databases, there is a key-value store that is distributed as a hash table, there is bigtable that is a multi-dimensional tabular system, and there is a graph-oriented database. Lastly, there is a document-oriented database such as CouchDB and Cloudant, which are the databases I chose for my final project [7].

From the Book “IBM Cloudant database as a service advanced topics”, I understood an important mechanism of Cloudant, and that is it supports replication for mobile devices. The definition of redundant is the ability to store data redundantly along with the cluster of the entire database and to replicate a subset of documents within one database to another, and there are different database replications types, there is bidirectional that deals with two databases. The continuous type that deals with instance up-to-date replication, and filterable that deals with a subset of the database documents, and many other types. By Cloudant, developers do not need to worry about managing the storage of data on the local device and the server. They do not need to think of how, where, and when to store their data. The API for mobile developers works to remove most of the backend complexity [8]. In addition, Cloudant Sync libraries handle the mapping of JSON documentation to SQLite relational data store on the device. The main reason I worked with Cloudant is that Cloudant sync libraries allow you to push database from your Cloudant cluster on the cloud immediately to your mobile application for local read and write operations, this should work even when your network connection is lost. With Cloudant, you can synchronize your data to many devices by using IBM Cloudant and Apache CouchDB. There are two main types of Cloudant synchronize libraries with different features, a type with API library designed for mobile applications, and a type of an index and query layer that closely matches the requirements of an application over what CouchDB view model does [8].

I worked with PouchDB to satisfy the offline-first sync experience as stated on the research paper “Offline-First Design for Fault Tolerant Applications”, by storing the embedded JSON documents of PouchDB to the local application state while CouchDB on the server side. Many devices can use the application and it will always function based on its current state and synchronize when needed.

Furthermore, I have found helpful solutions to some of the problems I faced during the phases of building my project. Therefore, instead of showing error messages as your connection is not available, try to show the stale data when offline instead. Furthermore, when facing a problem with local data loss for example user overwrite something and as the connection is established the original data can be lost, the solution is to disable editing while offline or to report these actions while offline later on [9].

The hybrid framework I used to build my mobile application is Ionic 3; it is one of the most widely used frameworks. I have learned Ionic by following the steps of the book “Hybrid Mobile Development with Ionic”, the book mainly focuses on Ionic 3 that is

4

the official version I have used for my application. On this book, I covered how to set up and install Ionic, what are the Ionic components, what are Ionic platform and its services, how to run ionic on a local host, and how to finally build your application and connect it to your mobile device. Furthermore, Ionic frameworks enable you to add your application as a platform easily. For example, if you want to add it by terminal then run “ionic cordova: platform add android” to display this application on your android mobile device [10].

In addition, CouchDB + PouchDB and Cloudant are all NoSQL databases, and I have decided to work with NoSQL databases in the mobile application for several good reasons. On the paper “NoSQL in a Mobile World: Benchmarking Embedded Mobile Databases” it is stated that the popularity of NoSQL databases is increasing over the years for mobile applications, and the reason for this is because NoSQL database has the ability to replicate itself, cloud synchronization capability, and document data model. It stated that NoSQL databases work amazingly for large data centers and that we need to choose the right technology depending on the requirements of our application [11].

Therefore, Perrier and Pervaiz did a benchmark between different NoSQL databases as shown in their paper [11]. The first step was to set up a large data set with random data, and then to create queries and documents depending on each database. After that, they defined a set of matrices to record the benchmark system. Next, they set up each database with an Android device. The result showed that the SQLite database performed great under a high load with complicated quires, and the CouchLite database performed decently on indexed lookups and queries, and DbO4 performed the best at creating and inserting because it was very fast.

To add up, NoSQL offers a lot more than just solving the problems of scaling. NoSQL offer speed even with a small amount of data and between different devices, it offers development time because you do not need to deal with complex SQL quires as joining multiple tables to create your final vision, and almost every NoSQL offer shameless data representation, which means that you don’t need to think too much for the data design structure, as adding new data and nesting an existing data. Lastly, plan for scalability that is to plan to never fall, which means your application can be elastic and it should be able to handle spikes of load [12].

A great advantage of NoSQL is that it ensures availability and partition tolerance to our data, and it ensures us data consistency by the replication approach. The main advantage of the NoSQL database is that it uses the scale-out approach. If many users start using the application then another server is added. There is no need to modify the application since the application always sees a single distributed database. Furthermore, usually relational databases are expensive, and you need to purchase the license, whereas NoSQL databases are generally inexpensive, free open source, and priced only to their additional services [13].

CouchDB NoSQL stores their data in the form of documents, it has many advantages as it supports complex data structure and it is easier for debugging, and conceptualizing data. Therefore, it is rather faster than the relational database because it stores an entire object as a JSON document instead of storing and retrieving data from interrelated tables. The conclusion of NoSQL is that it provides a schema-less dynamic flexible data model that is the most preferable for big data and users. NoSQL has the ability to scale dramatically, and it provides improved performance for many users expectations [13].

Cite this page

Mobile App Offline Data Synchronization. (2019, Dec 19). Retrieved from http://studymoose.com/mobile-app-offline-data-synchronization-essay

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment