> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Management

> Managing ambient sessions, lifecycle, and data handling in the Mobile SDK

<Accordion title="How do I create a new session?">
  Create a session by providing patient information and clinical sections:

  Create a session by providing patient information (name, birthdate, gender), clinical sections for content generation, optional session ID, and multilingual settings through the createSession method.
</Accordion>

<Accordion title="What patient information is required for session creation?">
  The minimum required patient information includes:

  * **Name**: Patient's full name
  * **Birthdate**: Date of birth in Date format
  * **Gender**: "MALE" or "FEMALE"

  Additional optional information can be provided through the `setSessionContext` method.
</Accordion>

<Accordion title="Can I update session information after creation?">
  Yes, use the `setSessionContext` method to update patient information, provider details, or add diagnosis codes after session creation:

  Use the setSessionContext method to update patient information, provider details, or add diagnosis codes after session creation.
</Accordion>

<Accordion title="Does the Mobile SDK support Problem-Based Charting (PBC)?">
  Yes. Pass existing patient diagnoses with `SukiAmbientConstant.kDiagnosisInfo` in `setSessionContext`, configure LOINC sections for the note, and retrieve structured diagnoses after the session with `getStructuredData(for:)`. Behavior matches the Ambient APIs for reconciliation and output. Refer to [Problem-Based Charting](../../api-reference/capabilities/problem-based-charting), [Create session](../ambient-guides/create-session), and [Session status and content retrieval](../ambient-guides/session-status-and-content-retrieval#get-structured-data).
</Accordion>

<Accordion title="What are the different session states?">
  Sessions can be in the following states:

  * **NotCreated**: No session has been initialized
  * **Recording**: Session is actively recording audio
  * **Paused**: Recording is temporarily paused
  * **Ended**: Session completed, content generation in progress
  * **Canceled**: Session was canceled, no content will be generated

  Check the current state using `SukiAmbientCore.shared.sessionState`.
</Accordion>

<Accordion title="Can I pause and resume a recording session?">
  Yes, you can pause and resume sessions:

  The SDK provides pause and resume methods to temporarily stop and restart recording while keeping the session active.

  Note that you can only pause an active recording and only resume a paused session.
</Accordion>

<Accordion title="What's the difference between ending and canceling a session?">
  * **End**: Stops recording and begins AI content generation. Use this for completed sessions.
  * **Cancel**: Stops recording and discards all data. No content will be generated. This action cannot be undone.

  End stops recording and begins AI content generation for completed sessions, while Cancel stops recording and discards all data with no content generation.
</Accordion>

<Accordion title="Can I have multiple active sessions?">
  The current SDK version supports one active session at a time. You must end or cancel the current session before creating a new one.
</Accordion>

<Accordion title="How do I handle session errors?">
  All session methods can throw `SukiAmbientCoreError`. Always use do-catch blocks:

  All session methods can throw SukiAmbientCoreError. Use do-catch blocks to handle errors like session not initialized or attempting to record in the background.
</Accordion>

<Accordion title="What happens if I try to start recording in the background?">
  iOS doesn't allow apps to start recording while in the background. The SDK will throw an `appIsNotActive` error. You should:

  1. Handle this error gracefully
  2. Notify the user to bring the app to the foreground
  3. Retry the operation once the app is active
</Accordion>

<Accordion title="How do I know when content generation is complete?">
  Use the session delegate to receive real-time updates:

  Use the session delegate to receive real-time updates about content generation completion and handle events like suggestions generated or generation failures.
</Accordion>
