Official Content

Syntax

&SynchResult = Synchronization.Receive()

Where:

&SynchResult is a Numeric variable.

Description

This method receives in the device all the changes made in the server since last synchronization. When this method is executed the first time it tries to get all data from the server. Note that all received data is previously filtered in the server by appliyng the Offline Database Object conditions.

Note: If this method is executed inside a Composite block and for some reason the data reception fails, the Composite block execution stops, which means all actions declarated after this method call are not being executed.

Type returned

Returns one of the following values, which in GeneXus are defined in the SynchronizationReceiveResult domain:

Receive message code Receive message Receive message causes
0 Receive OK. Receive was successfully made.
1 Receive is not needed. All data is already synchronized.
2 Application is not offline. The application is trying to call the Synchronization programs from an Online panel.
3 Has pending events. Can not perform a Receive if there are already pending events to send. Check the Synchronization.Send method for further learning.
8 Already Running. A receive process is already running in the application.
51 Metadata error code received. Code: 1 The device is sending an invalid or old version of the OfflineDatabase for the synchronization by row.
52 Metadata error code received. Code: 2 The hashes sent to the server are invalid, so the server can not calculate the differences between the client tables and the server tables. 
53 Metadata error code received. Code: 3 The device is sending an invalid or old version of the OfflineDatabase.
99 Unknown error. Unknown error.

Note: Errors 51, 52, and 53 occur only in the server side, unlike the others which occur in the device.

Example

An example of calling the Receive method when pressing a button:

Event "MyAction"
    &SynchResult = Synchronization.Receive()
EndEvent

Scope

Objects Objects for Native Mobile applications development
Platforms Android, Apple iOS 

Considerations

For versions of GeneXus prior to GeneXus X Evolution 3 Upgrade 2, values returned by this method are defined like in the following table:

 
Receive message code Receive message
0 Receive OK.
1 Receive is not needed.
2 Application is not offline.
3 Has pending events.
4 Unknown error.
5 Metadata error code received. Code: 1
6 Metadata error code received. Code: 2
7 Metadata error code received. Code: 3

Availability

As from GeneXus X Evolution 3

See also




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