Pulsate Sessions

A Pulsate session represents one visit of a user in your app. Sessions power campaign delivery (one in-app notification is fetched per session), analytics, and segmentation.

Initialize the SDK

Initialize Pulsate in your Application class with the credentials from the Pulsate CMS (Settings → App Settings → SDK Connect):

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()

        val authData = PulsateAuthData(APP_ID, APP_KEY)
        PulsateFactory.getInstance(authData)
    }
}

If your credentials are in the manifest (Installation, Step 3), PulsateFactory.getInstance() with no arguments is enough.

Start the first session

You start the first session; Pulsate handles every session after that automatically. Sessions begin when the app enters the foreground and end when it goes to the background — you never end a session manually.

Start the session with the user's alias — the unique identifier for this user in your system (user ID, account number, etc.). The alias ties all devices of the same user to one Pulsate profile:

val pulsateManager = PulsateFactory.getInstance()
pulsateManager.startPulsateSessionForAlias(
    "unique-user-id-in-your-system",
    object : IPulsateRequestListener {
        override fun onSuccess() {
            // Session is active — safe to send user data now
        }
        override fun onError(e: Throwable?) {
            // Handle failure (no network, invalid credentials, ...)
        }
    },
)

⚠️

Starting a session requires a visible Activity. Do not call startPulsateSessionForAlias from Application.onCreate() — wait for your first Activity/Fragment. See Example Integration for where to place the call in a login flow.

Once started, sessions renew automatically forever — until you call logoutCurrentAlias.

Logging out

logoutCurrentAlias detaches this device from the user:

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

After logout, Pulsate can no longer reach this user on this device — no pushes, no in-app notifications, no feed posts, no geofence events — and the device's data no longer feeds segmentation. Think of it as a soft delete.

⚠️

Logout is not "end session". Sessions end automatically in the background. Only call logoutCurrentAlias when the user truly signs out and you want all Pulsate features disabled. After logout, you must call startPulsateSessionForAlias again (e.g. on next login) to re-enable Pulsate.

If you only want to hide Pulsate UI from logged-out users while keeping the device attached, use userHasLoggedIn() / userHasLoggedOut() instead of logging out.

Next step

See a complete example integration →