ExperienceSdk

This is the main entry point class to the ExperienceSDK. It is a singleton object.

Types

Link copied to clipboard
object Intervals

This object contains methods related to marked intervals. Marked intervals can be used to represent important, named time intervals with meta data so that measurement data can be associated with application/domain specific information.

Functions

Link copied to clipboard
open override fun addCustomProperty(key: String, value: Boolean)

Adds a custom boolean property to the custom property map of all subsequent events.

open override fun addCustomProperty(key: String, value: Number)

Adds a custom number property to the custom property map of all subsequent events.

open override fun addCustomProperty(key: String, value: String)

Adds a custom string property to the custom property map of all subsequent events.

Link copied to clipboard
open suspend override fun deleteSourceData()

Deletes all data from the device storage corresponding to the current source ID, and initiates the removal of all such data from the Experience Platform servers.

Link copied to clipboard
suspend fun init(app: Application, accountHash: String, configuration: ConfigurationBuilder.() -> Unit = {})

Initializes the ExperienceSDK. You must call this method before any other method can be called from the ExperienceSDK.

Link copied to clipboard
open override fun setSourceAttribute(key: String, value: Boolean, elapsedMillis: Long?)

Sends a custom boolean property for the given SDK installation (source).

open override fun setSourceAttribute(key: String, value: Number, elapsedMillis: Long?)

Sends a custom number property for the given SDK installation (source).

open override fun setSourceAttribute(key: String, value: String, elapsedMillis: Long?)

Sends a custom string property for the given SDK installation (source).

Link copied to clipboard
open suspend override fun start()

Starts or resumes the event collection (measurement).

Link copied to clipboard
open suspend override fun stop()

Stops the event collection (measurement).

Link copied to clipboard
open override fun track(event: SendableEvent<*>)
open override fun <T : Any> track(args: T, type: String, elapsedMillis: Long?)

Adds a custom event to the series of collected events.

Properties

Link copied to clipboard
open override val events: Flow<Event>

This Flow emits all the events that are generated/created by the ExperienceSDK and also those that are added externally by the host application with the track() method.

Link copied to clipboard

Represents whether the SDK can use metered (paid) networks for sending event data to the backend. Set this to false to restrict event sending to Wi-Fi networks only.

Link copied to clipboard
open override val sdkState: Flow<SdkState>

This Flow emits the state of the ExperienceSDK. You can use it e.g. to update the UI of the application if you want to allow the user to start or stop measurement.

Link copied to clipboard
open override val sourceId: Flow<String>

The Source ID is the identifier of the user of the host application. It is generated on the client side by the ExperienceSDK after the first initialization. The Source ID remains the same even if the app process is restarted until the source data is deleted. When the source data is deleted, the SDK generates a new Source ID.

Link copied to clipboard
const val version: String

The version of the ExperienceSDK.

Link copied to clipboard
open override val warning: Flow<ExperienceSdkException>

This Flow emits any warnings that occur asynchronously during the lifetime of the SDK. These are exceptions that do not affect the client side functionality of the SDK.