Upsight logo Back to top

Basic Messages

HashMap

Overview


When a method accepts optional parameters, they must be sent as a HashMap.

HashMap

Required Parameters


HashMap

Optional Parameters


HashMap

Code Example


Any examples with a params object assumes that a HashMap has already been declared like in the following example:

Map<String, String> params = new HashMap<String, String>();

Add optional params by using the put method:

params.put(<param>, <value>);

Clear your HashMap by using the clear method:

params.clear();

startSession

Overview


Call this method to initiate the SDK. An apa message will be sent on first run.

Note The Enterprise SDK creates a user identifier, referred to as the sender ID. This ID can be substituted with another identifier (i.e. Your own ID). When substituting with another identifier, ensure that it is an integer, otherwise it will not pass.

Warning Using a custom sender ID instead of the one generated by the SDK can result in potential drawbacks for marketing and analytics. For further information, please contact your CSM or Upsight Support.

startSession

Required Parameters


Parameter Type Description
ApiKeystring The API Key of your application. This key is automatically generated when you set up your application in your Dashboard.
modestring Determines whether you send data to Upsight Analytics Test or Production servers. For Production, set this parameter to: Kontagent.PRODUCTION_MODE. For Test, set this parameter to: Kontagent.TEST_MODE.

startSession

Optional Parameters


Parameter Type Description
senderIDunsigned 64-bit int A unique, unsigned 64-bit integer in the form of an NSString. This parameter denotes the unique identifier of the application user. If your application creates user IDs larger than 64-bits, you must convert the user ID to an unsigned 64-bit integer to send to Upsight Analytics. For more information click here.

startSession

Code Example


Start a session. The SDK generates a user ID automatically.

Kontagent.startSesssion("<apikey>", <context>, <SDK_MODE>);

Start a session by specifying your own user ID. This ID will be used in all sent messages.

Kontagent.startSesssion("<apikey>", <context>, <SDK_MODE>, "<sender_id>");

Start a session without sending "Application Added" on first run.

Kontagent.startSession("<apikey>", <context>, <SDK_MODE>, false);

Start a session without sending "Application Added" on first run AND with specifying your own user ID.

Kontagent.startSession("<apikey>", <context>, <SDK_MODE>, "<sender_id>", false);

stopSession

Overview


Call this method to close the session. No parameters are required.

stopSession

Required Parameters


No required parameters.

stopSession

Optional Parameters


No optional parameters.

stopSession

Code Example


When the application loses focus, you should call this to write all unsent calls to disk.

Kontagent.stopSession();

sendDeviceInformation

Overview


This method gathers manufacturer, model, OS version, and carrier on launch of the application. You should call this method upon every launch.

sendDeviceInformation

Required Parameters


No required parameters.

sendDeviceInformation

Optional Parameters


Parameter Type Description
v_majstring Major version number. This represents your version number scheme, and is limited to 50 characters. Valid characters are a-z, A-Z, 0-9, -, ., and _.
datastring A JSON object string that is not base64 encoded.

sendDeviceInformation

Code Example


Kontagent.sendDeviceInformation(null);

params.put("v_maj", "1.2.3");

Kontagent.sendDeviceInformation(params);