Testing the Connection Between the SDK and the Server

The testConnection() function tests the connection between the SDK and the Server. If a valid configuration file exists from createConfig(), the URL used for the test will be the one in that file, set by the Server. Otherwise, the URL used for the test will be the one set by the client in the call to createConfig() . The proxy is used during the test if set by calling setProxy().

This method allows you to test your application’s connectivity with the Usage Intelligence server and to confirm that your CallHome URL is active and operational (for debugging purposes when using a custom CallHome URL). You do NOT need to call this method before other API calls since this would cause unnecessary traffic on your clients’ machines. Instead, you should check the return types by each API call since every API call that requires server communication does its own connection status check and returns any connection errors as part of its return type.

The testConnection() functioncan be called between createConfig() and stopSDK() and can be called zero or more times.

The testConnection() function is a synchronous function and only returns with all functionality is completed.

testConnection()

RUIResult testConnection()¶

Returns

The testConnection() function returns one of the RUIResult enum values below::

testConnection() 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_OPTED_OUT

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

CONFIG_NOT_CREATED

Configuration from createConfig() has not been successfully created.

SDK_NOT_STARTED

SDK has not been successfully started.

SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

NETWORK_CONNECT_ERROR

Not able to reach the Server.

NETWORK_SERVER_ERROR

Error while communicating with the Server.

NETWORK_RESPONSE_INVALID

Message format error while communicating with the Server.

TEST_CONNECTION_INVALID_PRODUCT_ID

Invalid Product ID.

TEST_CONNECTION_MISMATCH

Mismatch between Product ID and URL.