Starting a Session

The startSession() function starts an explicit session for event tracking in the SDK. It must be paired with a call to stopSession().

Explicit sessions are allowed only if createConfig() was called with multiSessionEnabled = true. When explicit sessions are enabled, a valid sessionID becomes a required parameter to the event tracking APIs, as described in Parameters.

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

startSession() is a synchronous function, returning when all functionality is completed.

startSession()

RUIResult startSession(String sessionID)

Parameters

The startSession() function has the following parameters.

startSession() Parameters

Parameter

Description

sessionID (String)

This parameter should contain a unique ID that refers to the user session that is being started. This same ID should later be used for event tracking. sessionID must be at least 10 characters long and no longer than 64 characters.

The content of a sessionID is conditioned and validated (after conditioning) with the following rules:

Conditioning—All leading white space is removed.
Conditioning—All trailing white space is removed.
Conditioning—All internal white spaces other than space characters (' ') are removed.
Validation—Cannot be shorter than 10 UTF-8 characters.
Validation—Cannot be longer than 64 UTF-8 characters.

The resulting conditioned and validated sessionID must be unique (i.e. not already in use).

Note:With the above conditioning, two sessionIDs that differ only by white space or after the 64th character, will not be unique. A sessionID should not be re-used for different sessions.

Returns

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

startSession() Returns

Return

Description

OK

Function 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.

FUNCTION_NOT_AVAIL

Function is not available.

SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

INVALID_SESSION_ID_EXPECTED_NON_EMPTY

The sessionID is expected to be non-empty, and it was not.

INVALID_SESSION_ID_TOO_SHORT

The sessionID violates its allowable minimum length.

INVALID_SESSION_ID_TOO_LONG

The sessionID violates its allowable maximum length.

INVALID_SESSION_ID_ALREADY_ACTIVE

The sessionID is already currently in use.