Before trying to run Pulsate make sure you have properly installed Pulsate - https://pulsate.readme.io/v2.8.2/reference/installing-the-android-pulsate-sdk

To start a session all that you need to do is call "startPulsateSession" or "startPulsateSessionForAlias". Below we will explain both methods and what is different.

Pulsate automatically starts and ends sessions for you after you start the first session. The sessions will be automatically managed for you until you logout the user from Pulsate. If you do not need to logout the user don't do it.

❗️

Starting a Pulsate Session requires an Activity

Starting a session in the "onCreate()" method of your Application class is not supported.
Pulsate requires an active activity to start, so wait for the first Activity "onCreate" callback before starting a session.

1. Simple Session - startPulsateSession

Simple Sessions use a "Device Guid" to identify this user on this device. Everytime "Device Guid" changes a new user is created and the old user data can no longer be connected to the new user.
If the user has multiple devices or updates his current device each device will have a different "Device Guid" and will be a different user in our system. "Device Guid" can also change if the user reinstalls the App, formats his device or clears App Data.

In order to start a simple session use the startPulsateSession: method.

val pulsateManager = PulsateFactory.getInstance()
pulsateManager.startPulsateSession(object : IPulsateRequestListener {
		override fun onSuccess() {
		}

		override fun onError(e: Throwable?) {
		}
})

2. Deduping Session - startPulsateSessionForAlias

Deduping is the process of setting a unique identifier for a user as their customer alias so that we can recognise when that user uses your app on multiple devices. Deduping helps to improve data quality by ensuring that the same user can have multiple devices added to their profile instead of different Pulsate profiles being created for each device.

The customer alias can be any identifier that you choose that will not change for that user. Customer Number is an example of a suitable identifier that would make a good alias because customer number is a parameter that is unlikely to change. Conversely, an email address is not a good choice as an identifier because there is a strong possibility that a user could change their email in the future.

In order to use the deduping feature, you need to use the startPulsateSessionForAlias: method, instead of startPulsateSession on the PulsateManager. You need to pass the unique client identifier as the parameter.

val pulsateManager = PulsateFactory.getInstance()
pulsateManager.startPulsateSessionForAlias(
		alias = "my_user_alias",
    object : IPulsateRequestListener {
    		override fun onSuccess() {
        }

        override fun onError(e: Throwable?) {
        }
})

3. Logout

If your user logs out, in order for him to stop sending data and getting new campaigns you need to call the logoutCurrentAlias method.

val pulsateManager = PulsateFactory.getInstance()
pulsateManager.logoutCurrentAlias(object : IPulsateRequestListener {
		override fun onSuccess() {
    }

    override fun onError(e: Throwable?) {
    }
})