Forced Synchronization

Under normal conditions, you do not need to instruct the Usage Intelligence SDK when to synchronize with the cloud server, since this happens automatically and is triggered by application interaction with the API. In a typical runtime session, the SDK will always attempt to synchronize with the server at least once whenever the application calls startSDK(). For long running applications, the SDK will periodically sync with the server every 20 minutes.

For applications that require a more customized synchronization, the API also provides an option to request manual synchronization of all cached data. This is done by calling the sync() function.

The sync() function performs a manual synchronization with the Server. The SDK periodically performs automatic synchronizations with the Server. sync() provides the client an ability to explicitly synchronize with the Server at a specific time. The manual synchronization can request a ReachOut with getReachOut.

Note:Similar to the parameter reachOutOnAutoSync (on function createConfig()), the ReachOut will not be requested if there is no registered handler (SDK constructor and setReachOutHandler()).

sync() can be called between startSDK() and stopSDK() and can be called zero or more times.

Note: sync() will not be successful if a New Registration is in progress (i.e. createConfig() and startSDK()). A manual synchronization with the Server can be associated with stopSDK().

sync() is an asynchronous function returning immediately with further functionality executed on separate thread(s).

sync()

RUIResult sync(boolean getReachOut)

Parameters

The sync() function has the following parameters.

sync() Parameters

Parameter

Description

getReachout (boolean)

This optional parameter instructs the server whether to send a ReachOut message during this particular sync if available.

Returns

The sync() function returns one of the return status constants below.

sync() Returns

Return

Description

OK

Synchronous functionality successful.

SDK_INTERNAL_ERROR_FATAL

Irrecoverable internal fatal error. No further API calls should be made.

SDK_ABORTED

A required New Registration has failed, and hence the SDK is aborted. stopSDK() is possible.

SDK_PERMANENTLY_DISABLED

The Server has instructed a permanent disable.

SDK_SUSPENDED

The Server has instructed a temporary back-off.

SDK_OPTED_OUT

Instance has been instructed by the application to opt-out.

CONFIG_NOT_CREATED

Configuration has not been successfully created.

SDK_NOT_STARTED

SDK has not been successfully started.

SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

TIME_THRESHOLD_NOT_REACHED

The API call frequency threshold (set by the Server) has not been reached.