Skip to content

Commit

Permalink
feat(ios): expose API to get current session ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Adwin Ronald Ross committed Dec 31, 2024
1 parent 0a62043 commit 0be7b1d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ios/MeasureSDK/Measure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,15 @@ import Foundation
}
}
}

/// Returns the session ID for the current session, or nil if the SDK has not been initialized.
///
/// A session represents a continuous period of activity in the app. A new session begins when the app is launched for the first time, or when there's been no activity for a 20-minute period.
/// A single session can continue across multiple app background and foreground events; brief interruptions will not cause a new session to be created.
/// - Returns: The session ID if the SDK is initialized, or nil otherwise.
func getSessionId() -> String? {
guard let sessionId = measureInternal?.sessionManager.sessionId else { return nil }

return sessionId
}
}

0 comments on commit 0be7b1d

Please sign in to comment.