Sessions¶
Part of the Human Scoring use case.
A session is the stretch of interaction a classification
is about. The SDK starts one when you create the DeaSdk. Tell the SDK when a session ends in a way
only your app knows about — a logout or an account switch — so that one user's interaction is never
counted toward the next user's classification. It is not the
ad session that DEA opens for one ad in the
Ads use case.
When to use it¶
- The user logs out
- The user switches accounts
- You need the current session id, for example to include in a support request
Prerequisites¶
- The SDK is installed and started. See the Quick Start.
Usage¶
Start a new session¶
reset() ends the current session and starts a new one with a new id. Evidence collected before
the reset does not count toward the new session's classification. Consent is not affected, and a
model the SDK downloaded stays in use.
Read the current session¶
import DeaBase
import DeaSDK
if let info = Dea.sdk?.sessionInfo {
print(info.session) // current session id, a UUID
print(info.sdk.version) // SDK version
print(info.device.surface) // current screen size, in points
print(info.device.rotation) // 0, 90, 180 or 270
}
sessionInfo is a quick read. The device information stays current when the screen rotates, or the
window is resized on iPad.
Shut the SDK down¶
dispose() stops capture, the model update checks and the automatic
attestation renewal, and
releases the SDK. A disposed instance cannot be started again: to start over, create a new
DeaSdk and call start().
Examples¶
Reset on logout¶
import DeaSDK
func logout() async {
await authService.signOut()
Dea.sdk?.reset()
showLoginScreen()
}
Replace authService and showLoginScreen with your own.
API¶
| Member | Returns | Description |
|---|---|---|
reset() |
Void |
Ends the session and starts a new one |
sessionInfo |
SessionInfo |
Session id, device and SDK version |
dispose() |
Void |
Stops capture and releases the SDK |