Don't forget to replace the %YOUR_STORE_KEY% text with the current store key from your PersonaClick account.
private lateinit var sdk: SDK
/**
* Entry point for the application's activity where the SDK is initialized.
* The SDK supports two types of initialization:
* - **Basic Initialization:** Only the required parameters are provided for minimal configuration.
* - **Extended Initialization:** Includes optional parameters for more advanced customization.
*
* You can choose the initialization method that best suits your application's needs.
*/
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sdk = SDK()
/**
* Initializes the SDK with a simple configuration.
* This method is suitable if you only need the basic functionality of the SDK.
*
* @param context Context - Required. The application context used for SDK initialization.
* @param shopId String - Required. The shop identifier, necessary for the SDK to function.
*
* @example
* sdk.initialize(
* context = applicationContext,
* shopId = "%YOUR_STORE_KEY%"
* )
*/
sdk.initialize(
context = context,
shopId = shopId
)
/**
* Initializes the SDK with an extended configuration.
* This method provides additional options for advanced use cases.
*
* @param context Context - Required. The application context used for SDK initialization.
* @param shopId String - Required. The shop identifier, necessary for the SDK to function.
* @param apiDomain String? - Optional. The API domain that the SDK will interact with. Default is null.
* @param tag String? - Optional. A tag used for configuring logs, making it easier to identify SDK messages.
* Default value is "SDK," but you can specify your own tag name.
* @param autoSendPushToken Boolean - Optional. Enables automatic token sending during initialization. Default is true.
* @param needReInitialization Boolean - Optional. Allows you to reinitialize the SDK and clear the storage. Default is false.
*
* @example
* sdk.initialize(
* context = applicationContext,
* shopId = "YOUR_SHOP_ID",
* apiDomain = "YOUR_API_DOMAIN",
* tag = "CustomTag",
* autoSendPushToken = true,
* needReInitialization = false
* )
*/
sdk.initialize(
context = applicationContext,
shopId = "%YOUR_STORE_KEY%",
apiDomain = API_DOMAIN,
tag = TAG,
autoSendPushToken = true,
needReInitialization = false
)
}