Official Content

Most offline applications are not usually stand-alone applications but just a subset of a larger server system, as explained in the Offline Native Mobile applications architecture document. For that reason, there should be a connection between the offline applications and the server to send and receive data from the device to the server and vice-versa.

This process is defined as "Data Synchronization" and you, as a GeneXus developer, may adopt a strategy to solve the Data Synchronization Problems.

Data flow

Initialization

Once the application is installed in the device, a local database is created. After that, you might fill that database so that the user can start using the offline application. To do that, a possibility is to receive data from the server. This can be done by calling the Receive method of the GeneXus synchronization programs. See the Synchronization.Receive method documentation for further information.

After calling this method, the device receives all necessary information and stores it in the local database. Also, if there are any referenced files like images, blobs or whatever, all of them are stored in the device.

Another alternative is to install your application with preloaded data. To do this follow the instructions at the HowTo: Create offline mobile applications with a preloaded database document.

Managing data changes

When the application data is filled, the user can interact with the application, perform changes (like insertions, deletions and updates) and send them to the server 1; as in the same way, changes made by other users may occur in the server. This may cause the application not to be synchronized with respect to the server.
In order to handle these problems GeneXus splits the Synchronization process in two: The Data Reception process and the Data Sending process. Both processes can be set up in GeneXus by changing some specific properties of the Offline Database object.

The Data Reception behavior is set by following properties:

On the other hand, the Data Sending behavior is set by the Send Changes property.

In addition, if you don't want to use the GeneXus generated synchronization programs, you can resolve the synchronization by Coding your Data Synchronization programs which, of course, takes a lot more of work.

1 It is important to note that only modifications (insert, update, delete) made by Business Component to the local database are considered to be sent when the Synchronization API Send method is executed (manually or automatically). See Advanced Concepts of Offline Applications architecture for more details.

See Also



Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant