Links may not function; however, this content may be relevant to outdated versions of the product.
- Initiates data synchronization when the user interacts with the control that
you configure to invoke the
Run scriptaction. When the datasyncStart method is called, the synchronization indicator immediately displays the Syncing/Synced message.
- Sets the interval (in milliseconds) between subsequent synchronization sessions when the server is available. The default value is 300000 ms (5 minutes). The value must be greater than 0.
- Sets the interval (in milliseconds) between subsequent synchronization sessions when the server is not available. The default value is 60000 ms (1 minute). The value must be greater than 0.
- Sets the number of actions in the action queue that must be reached before synchronization is triggered. The default value is 1, which means that the app sends actions immediately to the server after they are added to the action queue.
- Sets the amount of time (in milliseconds) that must pass from the moment an action is queued in the client store before synchronization is triggered. The default value is 0, which means synchronization happens immediately.
- Enables or disables synchronization triggering after the user processes the last step in an assignment. The default value is false.
- Specifies whether synchronization triggering is enabled after the user processes the last step in an assignment.
- Sets the maximum number of actions that can be sent with a single request. The default value is 60, which means that the app sends up to 60 actions in each synchronization request. When you set the value to -1, you remove the limit, which means that a synchronization request can include an infinite number of actions.
- Sets the time (in milliseconds) that must pass from the start of the synchronization session before the Syncing/Synced label appears on the screen. By default, it is set to 4000 ms (4 seconds). The value must be greater than 0.
- Sets the time (in milliseconds) that must pass from the end of the synchronization session before the Synced label disappears from the screen. The default value is 5000 ms (5 seconds). The value must be greater than 0.
Synchronization listenerYou can add an event listener that the system calls when the app starts synchronizing data or when the synchronization status changes, for example, to calculate how much time has elapsed from the last synchronization.
trueafter the listener is registered. Returns
falsewhen an error occurs and adding the listener fails.
The data synchronization listener has the following callbacks:
- Required. Called when data synchronization starts.
The callback receives
causeas an argument that reflects what triggered the synchronization:
pega.offline.DataSync.START_CAUSE_TYPICAL = 0when a user performs an action that triggers the synchronization, or in case of an automatically recurring synchronization.
pega.offline.DataSync.START_CAUSE_MANUAL = 1when a user manually triggers the synchronization.
pega.offline.DataSync.START_CAUSE_NETWORK_BECAME_AVAILABLE = 2when the app detects network availability and consequently triggers a synchronization.
pega.offline.DataSync.START_CAUSE_APPLICATION_BECAME_VISIBLE = 3when the user brings the app to the foreground or turns on the screen, and consequently triggers a synchronization.
- Required. Called when the synchronization status changes.
The callback receives
statusas a JSON object that reflects the current synchronization status through the following keys and corresponding values:
isEvent = truewhen the app updates the synchronization status, otherwise
isEvent = false
isBusy = truewhen synchronization is in progress, otherwise
isBusy = false
isError = truewhen an error occurs, otherwise
isError = false
Tip: For more information about the types of errors in offline-enabled mobile apps, see PEGA0066 alert: Mobile App Data-Sync Failure.
isNetworkError = truewhen the error is network-related, otherwise
isNetworkError = false
Note: Network errors are common in real-life scenarios and are fully recoverable after the network is available again.
eventdefines the event that triggered the synchronization status update by taking a corresponding value (
FAILED), for example,
- Optional. Called when the app detects the server as accessible.