Stopping the SDK

The ruiStopSDK() function stops the SDK that was started with ruiStartSDK(). This function should always be called at the exit point of your application.

If explicit sessions are allowed (multiSessionsEnabled = true in ruiCreateConfig()), then any sessions that have been started with ruiStartSession() that have not been stopped with ruiStopSession() are automatically stopped. A manual synchronization with the Server, ruiSync(), will be performed at stop depending on the value of doSync (as described in Parameters).

ruiStopSDK() must be called after ruiStartSDK() and must be called only once. After ruiStopSDK() is called, the various event tracking APIs are no longer available. The only APIs available are ruiGetState() and the ruiDestroyInstance(). The SDK cannot be re-started with a subsequent call to ruiStartSDK().

ruiStopSDK() is a synchronous function, including the manual synchronization with the Server (if requested), returning when all functionality is completed.

ruiStopSDK()

RUIRESULT ruiStopSDK(RUIINSTANCE* ruiInstance, int32_t doSync)

Parameters

The ruiStopSDK() function has the following parameters.

ruiStopSDK() Parameters

Parameter

Description

ruiInstance (RUIINSTANCE*)

Pointer to the Usage Intelligence instance created via ruiCreateInstance()

doSync (int32_t)

Indicates whether to do a manual synchronization as part of the stop, and if so, the wait limit.

A manual synchronization with the Server, ruiSync(), will be performed at stop depending on the value of doSync:

1—Do not perform a manual synchronization with the Server as part of the stop.
0—Perform a manual synchronization with the Server as part of the stop; wait indefinitely for completion.
>0—Perform a manual synchronization with the Server as part of the stop; wait only doSync seconds for completion.

Returns

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

ruiStopSDK() Returns

Return

Description

RUI_OK

Function successful.

RUI_INVALID_SDK_OBJECT

SDK Instance parameter is NULL or invalid.

RUI_SDK_INTERNAL_ERROR_FATAL

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

RUI_SDK_ABORTED

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

RUI_CONFIG_NOT_CREATED

Configuration has not been successfully created.

RUI_SDK_NOT_STARTED

SDK has not been successfully started.

RUI_SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

RUI_INVALID_DO_SYNC_VALUE

The doSync manual sync flag/limit violates its allowable range.