Java/Kotlin SDK
This document provides information on how to use the Hackle SDK for web browsers or apps created with Java/Kotlin.
Follow the links below to be redirected to the necessary code for each step.
Step 1: Integrating SDK SDK Integration
Step 2: Setting up user identifiers and properties User Identifier and Properties
Step 3: (For A/B test) Setting up traffic distribution for different test groups Traffic Distribution
Step 4: (For feature flags) Setting up features for on/off state of feature flags Feature Flag Determination
Step 5: (For A/B test and data analytics) Setting up tracking specific user events for data collection and analysis Track and Send User Events
Before You Read
- If this is your first time working with an SDK, please refer to the What is a SDK? document
1. Supported language
The Hackle Java/Kotlin SDK only supports JDK 8 or higher.2. Keys used in the SDK
There are several keys mentioned in this document. In order to find out where to obtain these keys and the roles of each key during the SDK integration, please read Keys Used by SDK Functions before you read this document.
Sequence of SDK Integration and Configuration
1. SDK Integration
You must integrate the SDK into your personal code in order to use Hackle's services.
You only have to do SDK Integration once. For example, if you are already tracking and sending events but would like to also use the feature flag function, you do not need to re-integrate a new SDK. Once integrated, you're all connected. Make sure you do not initialize the SDK multiple times, as this may lead to problems.
2. The Functions of SDK
Different types of SDK functions can be used together depending on the main purpose. This should also be set in advance before using the functions.
Some typical use cases include:
Case 1. A/B Testing
This function distributes incoming user traffic into test groups A, B, and C and returns the information on the assigned groups of the users back to the server to keep a record of each user’s exposure after the distribution is complete. We also call this the "distribution into test groups" function.
After distribution, the SDK collects the user behavior accordingly to each test group. The user behavior is a pre-defined user event.
This step is necessary to calculate the metrics and findings of A/B testing.
Case 2. Feature Flag
If you apply a feature flag for a specific feature, you can enable or disable that feature with a single click on the Hackle Dashboard. The SDK needs to be able to get those values at the code level and consequently determine the on/off state of the feature flag for each user.
Case 3. Funnel Analysis
Once a user behavior or event is set in the funnel steps, the track and send events function is used.
Case 4. Assign User Properties and Send
User properties can be assigned to users and sent together when distributing traffic into test groups / determining feature flags / sending user events.
Event properties can be assigned to an event, and can be sent together when tracking/ sending user events.
Updated about 1 year ago