- 01 Aug 2025
- 1 Minute to read
- DarkLight
Step 3: Initializing and Loading the SDK
- Updated on 01 Aug 2025
- 1 Minute to read
- DarkLight
Initializing and Loading the SDK
To initialize the SDK, create a ULConfiguration
object. This will store basic settings, the api key, and the up-code which will be given to each partner by an UpLift Representative.
Once created, set it to the ULUpliftSDK
. It is highly recommended to not hardcode the UP-Code and API key in the source code, instead store them securely. E.g.: in a .properties
file that is not pushed to a git repository.
Uplift manages all partner configuration and offerings through unique partner IDs that are called up-codes. Partners are provided two up-codes, one for development and one for production. It is crucial to diligently use the correct up code for each respective stage, whether it is development or production.
It is important to note that several functionalities of the SDK are only accessible after successful initialization. If the application tries to use these functions without initialization, an ULError
exception is thrown, with the ULErrorTypeSDKNotInitialized
type.
The technical documentation provides detailed information on which method calls require initialization.
val apikey = "your api key goes here"
val upCode = "UP-xxxxxx-xx"
val configuration = ULConfiguration(
upCode = upCode,
apiKey = apikey
)
ULUpliftSDK.getInstance().setConfiguration(this, configuration, object : ConfigurationCallback {
override fun onSuccess() {
// This method will be triggered when the initialize method succeeded
}
override fun onError(error: ULError) {
// This method will be triggered when the initialize method failed
}
})
After successfully configuring the SDK, it automatically sets the initial locale associated with the up-code. This can be modified at any time by the host application. All that is required is to set a ULLocale
object to the SDK. This object defines the language and currency used in the SDK.
Please note that you can only use locales that are available for your up-code. Once you have successfully configured the SDK, you can check the list of available locales and currencies.
val locale = Locale.US
val currency = ULCurrency.ULCurrencyUSD
val loc = ULLocale(
locale = locale,
ulCurrency = currency
)
val error = ULUpliftSDK.getInstance().selectLocale(loc)
if (error != null) {
//Success locale setting
} else {
//Error at locale setting:
}