By setting the Data Receive Criteria property to 'On Application Launch' or 'After Elapsed Time' GeneXus is going to be in charge of calling the initialization and update processes of the Offline tables of the application.
This is the first load of the local database with the records of the server's database. Initialization happens as follows:
- When the application is installed on the device, the database is created (this is independant of the synchronization criteria)
- After the database is created the initialization process is started.
This process brings the required data from the server and inserts it on the local database. Records can be filtered on the Conditions tab of the Offline Database Object.
- After all the data is synchronzed, a set of hashes is also stored on the device. This hashes will make it possible to determinate if a table, in the future, has changed or not.
After this process is done, the application is ready to be used and can start reading, inserting and updating this local database via GeneXus Objects as usual.
The synchronization processes that update the local database are called automatically providing that at least:
How is the Synchronization done?#
On a Receive operation, the server sends the required data to the devices, and also sends a set of hashes identifying the version of the data for each table.
This hashes are stored locally on the devices, and are sent on the next Receive operations, so that the server knows the data stored in the devices.
The server computes the new hashes for the tables, and only sends information from the changed tables. The ones that did not change are not sent.
Depending on the Data Receive Granularity property, the data sent from the server to the device may consist on the full table (after applying the conditions), or only the differences with the device's data.