Basic Integration Steps
The most basic Usage Intelligence integration can be accomplished by following the steps below. It is however recommended to read the more advanced documentation as Usage Intelligence can do much more than the basic functionality that can be achieved by following these steps.
To perform basic integration:
1. | Download the latest SDK from the following page in the Revenera Community, and extract it to your preferred project location. |
Usage Intelligence SDK Download Links and API Documentation
2. | Include the rui-sdk-<version>.jar file in the build environment for your Java application. |
3. | Add the directives import com.revulytics.rui.sdk.* and import com.revulytics.rui.sdk.core.* to any file that will be using the Java SDK. |
4. | Create an instance of the RUISDK object. |
boolean registerDefaultReachOut = false;
RUISDK mySDK = new SDKImpl(registerDefaultReachOut); // note no default graphical ReachOut available in Java SDK. Must be false. Value true is ignored.
5. | Create the configuration point to the directory where the Usage Intelligence SDK will create and update files. The application using Usage Intelligence will need read and write access rights to this directory. |
String myPath = "<path to directory for RUI SDK logging>";
String myProductId = "<Product ID>";
String myAppName = "<AppName>";
String myURL = "<CallHome URL without protocol prefix>";
String myKey = "<Your AES HEX Key>";
RUIProtocol myProtocol = RUIProtocol.HTTP_PLUS_ENCRYPTION;
boolean myMultiSessionSetting = false;
boolean myReachOutAutosyncSetting = false;
mySDK.createConfig(myPath, myProductId, myAppName, myURL, myProtocol, myKey, myMultiSessionSetting, myReachOutAutosyncSetting);
Note the following:
• | The Call Home URL, the Product ID and the AES Key can be retrieved from the Administration page (within the Usage Intelligence Dashboard). |
• | The protocol choice is based on the application and environment needs. Setting protocol to RUIProtocol.HTTP_PLUS_ENCRYPTION (port 80) will give applications the greatest chance of success in most environments. |
• | The Multiple Session flag is a boolean value where you specify whether your application can have multiple user sessions per runtime session. This is normally false. |
Note:For further details, refer to Single vs. Multiple Session Modes.
• | The ReachOut Auto Sync flag indicates whether or not a ReachOut should be requested as part of each SDK Automatic Sync. A ReachOut request will be made only if a ReachOut handler has been set by registering the default graphical handler, SDKImpl(), or a custom handler, setReachOutHandler(). |
6. | Initialize the SDK with your product information. This is most conveniently done via the setProductData() call. This must be done BEFORE calling startSDK(). |
String myProductEdition = "Professional";
String myLanguage = "US English";
String myVersion = "5.0.0";
String myBuildNumber = "17393";
RUIResult result = mySDK.setProductData(mySDK, myProductEdition, myLanguage, myVersion, myBuildNumber);
7. | Initialize the SDK with any optional custom properties by calling the function setCustomProperty(). |
8. | Call the function startSDK(). |
Note:You must set all known values for product data and custom properties BEFORE calling startSDK() otherwise you risk having null values for fields not specified. Once these calls are completed, you can safely call startSDK().
Before making any other API tracking calls, you MUST call startSDK(). It is recommended that you place this call at the entry point of your application so the SDK knows exactly at what time your application runtime session was started. If using multi-session mode, you also need to call startSession() when a user session is started, and also provide a unique user session ID that you will then also use for closing the session or for Feature / Event Tracking.
9. | Call stopSDK() when closing your application so the SDK knows when your application runtime session has been closed. |
Important:You must allow at least 5 seconds of application runtime to allow event data to be written to the log file and synchronized with the Server. If necessary, add a sleep of 5 seconds before calling stopSDK().
If using multi-session mode, when user sessions are closed, you should call stopSession() and send the ID of the session that is being closed as a parameter.
10. | Package your application by including the rui-sdk-<version>.jar file. |
The following is an example of the basic integration outlined below. This example uses single-session mode.
import com.revulytics.rui.sdk.*;
import com.revulytics.rui.sdk.core.*;
class MyApplication {
RUISDK mySDK;
public MyApplication()
{
//Create instance of RUISDK
boolean registerDefaultReachOut = false; // Java SDK does not support Default ReachOut
mySDK = new SDKImpl(registerDefaultReachOut);
//Set the file path and connection information
String myPath = "<path to directory for RUI SDK logging>";
String myProductId = "<Product ID>";
String myAppName = "<Your App Name>";
String myURL = "<CallHome URL without protocol prefix>";
String myKey = "<Your AES HEX Key>";
RUIProtocol myProtocol = RUIProtocolType.HTTP_PLUS_ENCRYPTION;
boolean myMultiSessionSetting = false;
boolean myReachOutAutosyncSetting = false;
mySDK.createConfig(myPath, myProductId, myAppName, myURL, myProtocol, myKey, myMultiSessionSetting, myReachOutAutosyncSetting);
// Set your product information
String myProductEdition = "Professional";
String myLanguage = "US English";
String myVersion = "5.0.0";
String myBuildNumber = "17393";
mySDK.setProductData(mySDK, myProductEdition, myLanguage, myVersion, myBuildNumber);
// If you have any custom properties set them here
//Inform Revulytics Usage Intelligence that the application has been started.
mySDK.startSDK();
//Your program logic...
}
private void close()
{
//Program closing - inform Revulytics Usage Intelligence that this runtime session is closing down and sync.
//Must allow at least 5 seconds between ruiStartSDK() and this call. If less than that, add a TimeUnit.SECONDS.sleep()
// or Thread.sleep() or other mechanism to provide enough time to send captured events to RUI Server
// values to pass stopSDK include : -1 - No manual sync as part of stop;
// 0 - perform manual sync and wait indefinitely for stop to finish
// >0 - perform manual sync and wait x seconds to completion
mySDK.stopSDK(0); // sync and wait indefinitely
//Your program logic...
}
}