Adopture Docs
SDKsFlutter

Sessions

Automatic session management in the Adopture Flutter SDK.

Sessions are managed automatically when autoCapture is enabled (the default). A session represents a single period of user activity in your app.

Session Lifecycle

  1. A new session starts when the app launches.
  2. The session remains active while the user interacts with the app.
  3. After 30 minutes of inactivity, a new session begins automatically.
  4. Backgrounding the app pauses the inactivity timer. Returning within 30 minutes continues the same session.

Session ID

Each session is assigned a unique UUID. You can access the current session ID at any time:

String? currentSession = Adopture.sessionId;

Session Events

When autoCapture is enabled, the SDK automatically tracks a session_start event at the beginning of each session. This event includes device context such as OS version, app version, and screen resolution.

Force a New Session

To manually end the current session and start a new one:

await Adopture.reset();

This also clears the user identity and event queue.

Background Behavior

When the app moves to the background, the SDK automatically:

  • Flushes any queued events to the server
  • Pauses the session inactivity timer

When the app returns to the foreground:

  • If less than 30 minutes have passed, the existing session continues
  • If 30 minutes or more have passed, a new session begins with a new session_start event

On this page