Session Management
A Session represents a continuous period of app usage by a user, and it starts and expires based on specific conditions.
Session Start Conditions
A session starts under the following conditions by default.
When the identifier changes
When an event occurs after the session timeout period has elapsed
Session Expiration Conditions
When a new session starts, the previous session expires.
The session expiration time equals the time of the last event.
Session Policy
The Session Policy is a feature that allows fine-grained control over session persistence and expiration conditions. A Session Policy consists of two types of conditions.
Persist Condition
Determines whether to maintain the existing session or start a new one when the identifier changes.
alwaysNewSession
Always starts a new session when the identifier changes.
default
nullToUserId
Keeps the existing session when userId changes from null to a specific value (i.e., on login). Starts a new session for any other identifier change.
-
Timeout Condition
Configures the conditions under which a session expires.
timeout
The session timeout duration.
1800 seconds (30 min)
onForeground
Whether to check the timeout when an event occurs in the foreground.
false
onBackground
Whether to check the timeout when an event occurs in the background.
true
onApplicationStateChange
Checks the timeout when the app state changes (foreground <-> background).
true
Last updated