Skip to content

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 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.

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, ...)
}
},
)

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

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.

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

See a complete example integration →