Stopping the SDK
The stopSDK() function stops the SDK that was started with startSDK().
If explicit sessions are allowed (multiSessionsEnabled = true in createConfig()), then any sessions that have been started with startSession() that have not been stopped with stopSession() are automatically stopped. A manual synchronization with the Server, sync(), will be performed at stop depending on the value of doSync (as described in Parameters).
stopSDK() must be called after startSDK() and must be called only once. After stopSDK() is called, the various event tracking APIs are no longer available. The only API available is getState(). The SDK cannot be re-started with a subsequent call to startSDK().
stopSDK() is a synchronous function, including the manual synchronization with the Server (if requested), returning when all functionality is completed.
RUIResult stopSDK(int dosync)
The stopSDK() function has the following parameters.
Parameter |
Description |
|||||||||
Indicates whether to do a manual synchronization as part of the stop, and if so, the maximum wait limit in seconds. A manual synchronization with the Server, sync(), will be performed at stop depending on the value of doSync:
|
Returns
The stopSDK() function returns RUIResult enum value with the following possible values:
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. |
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. |
INVALID_DO_SYNC_VALUE |
The doSync manual sync flag/limit violates its allowable range. |
Code Example
This example shows stopSDK() being called in the closing event of a form.
// Create instance
boolean registerDefaultReachOut = false; // no default ReachOut exists for Java SDK
mySDK = new SDKImpl(registerDefaultReachOut);
// Other initialization.....
private void close()
{
mySDK.stopSDK(5); // wait maximum of 5 seconds
}