Offline Data Caching, Capture, and SynchronizationIn order for a mobile application to function when an Internet connection is either unavailable or unreliable, the data your application needs to function must to be stored locally on the device. When signal is restored, newly entered (or edited) data can then be synchronized with data in the system of record.
How is Data Stored on a Mobile Device for Editing?Alpha Anywhere can store its data on the device using using one or more list controls. List controls are controls that are placed on a UX Component (a UX Component can be thought of as a user interface form). They can be populated from any kind of data source and they retain their data when the device is disconnected from the Internet. While disconnected they can be used to perform CRUD operations, and data can be resynchronized when a signal is restored. List controls require very little work to set up, but are limited in size to about 5MB of data since data is stored using the device's browser cache.
How does Synchronization Work?When in offline operation, Alpha Anywhere keeps track of records as they are added and updated in a list control. In cases of updates, Alpha keeps track of both the newly entered values and the original values. When signal is restored, data can be synchronized manually - say by a user pressing a button - or it can be done automatically, in which the application checks to see if there is an Internet connection and automatically syncs when one is detected. During synchronization, Alpha Anywhere checks for synchronization conflicts.
What Happens if There are Synchronization Conflicts?It is possible that when a record is edited in a list control offline by one person, that another person may also be editing that same record creating a data conflict. Alpha Anywhere can resolve these data conflicts either by allowing the user to decide which value(s) to keep or by following a business rule and handling the conflict automatically.
How Much Data Can be Stored?Alpha Anywhere applications can use most of the available free space on a device to store data. While the list control is limited to the 5MB of data storage space available in Local Storage, read-only data can be stored in the local file system. In addition, the list control records can store a variety of data captured on mobile devices on the local file system in apps built using the PhoneGap framework. Data stored in the local file system can be several gigabytes or more, enough to store millions of records in text, thousands of images, and hundreds of video recordings.
Client-side Data CacheThe client-side data cache is a local repository built into the UX component. Unlike the list control, data can be stored in the device's file system, so it is not limited to the 5MB limit. The client-side cache may require slightly more setup work than the list control, however it is a great way to store read-only application data.
Alpha Anywhere supports SQLite, a lightweight SQL-type database that can run locally on a mobile device. This requires more work to set up than the a list control or client-side data cache, but it is an excellent choice when an application is required to reference or quickly search a large set of records.