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

# Offline & lifecycle

> Queueing, flushing, and app-lifecycle behaviour.

## The options

```csharp Samples~/BasicIntegration/Assets/Scripts/GuideExamples.cs theme={null}
static PioOptions TunedOptions() => new PioOptions
{
    OfflineMode = false,         // true: instant init, fallback decisions, no network
    MaxEventQueueSize = 10000,   // oldest events evicted past the cap
    FlushIntervalSeconds = 30f,  // background flush cadence
    DecisionTimeoutMs = 2000,    // per-decision budget before the fallback serves
};
```

## Offline behaviour

With `OfflineMode` on, initialisation is instant, every decision returns the registered fallback immediately (`Source = Fallback`), and events enqueue but never flush. `TrackingEnabled = false` takes precedence over offline mode. `PIO.IsOffline` reports the mode at runtime.

Without it, the SDK degrades gracefully. A decision the device can serve [on device](/integration/decisions#where-decisions-run) keeps working without a connection once initialisation has succeeded. A decision that needs the cloud serves your fallback while the backend is unreachable. Events queue until connectivity returns.

## The event queue

Events enqueue synchronously and flush in background batches every `FlushIntervalSeconds`. The queue persists on device, so a force-quit loses nothing; unflushed events go out on the next launch. Past `MaxEventQueueSize`, the oldest events are evicted and an `EVENT_QUEUE_FULL` warning fires.

## Sessions

A session starts at initialisation and rolls over after `SessionTimeoutMinutes` of background time (default 5). `PIO.SessionId` identifies the current session; `PIO.UserId` is a stable identifier persisted on device. Custom state set with `SetState` is per-session.

## Decision timing

`DecisionTimeoutMs` (default 2000) is the per-decision budget for a cloud-served decision before the fallback serves. On-device decisions make no network call. Raise it for high-latency audiences; the trade is a longer worst-case wait at the decision point.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.