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

# Session management

> Manage SDK sessions and handle logout on Android

Sessions are managed automatically, so you don't need to explicitly start or end them.

For the concepts behind this, see [About sessions](/sdk/concepts/sessions).

## Reset on logout

When a user logs out, call `reset()` to clear all identity data and start a fresh anonymous session:

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
PillowSDK.reset()
```

<Warning>
  Always call `reset()` on logout. Without it, the next user on the same device could inherit the previous user's identity and study history.
</Warning>

## Offline support

The SDK queues operations locally when offline:

* Operations are persisted to local storage
* When connectivity returns, the queue drains automatically
* Operations older than 24 hours are discarded
* Duplicate operations are deduplicated

You can safely call `setExternalId()`, `setUserProperty()`, or `presentStudy()` even when the device is offline. The SDK processes them when the connection is restored.
