startSession
Creates a session and starts it, in one call.
Callable at any time and from anywhere — it needs no Activity and is not tied to onCreate, so it works from a nested Compose destination or a single-Activity host. The returned session must be held by an owner that survives configuration changes (e.g. a ViewModel).
Engine starts each scanner step from whichever of the app's Activities is in front, which it follows from app start (EngineInitializer), so the host never hands it one. A scanner step that comes up while none is in front, with the app in the background or its Activity being recreated, waits until one is. The scan comes back to the session in memory, not through the host, so the host may be recreated while a scanner is open.
The customer backend has already created the transaction, so this performs the initial backend resume — which carries the workflow snapshot — and turns it into the first StepResult. It never revives a transaction from a prior process.
Before that resume, Engine checks which SDK version the transaction's workflow was built for, which the configuration carries. A workflow built for an older major.minor version than this SDK's predates its changes, so Engine asks the backend to end the transaction, saying why, and returns Result.failure with an EngineException whose error is EngineError.UnsupportedWorkflowVersion.
It also returns Result.failure with an IllegalArgumentException if ServiceSettings.sdkConfiguration can't be read, and with an IllegalStateException if EngineInitializer hasn't run in this process. A scanner step whose SDK the app doesn't include fails later, when Session.next runs it, with EngineError.MissingScannerSdk. A session that comes back is always started: if that first Edge API call fails, this still returns success carrying a StepResult.Failed, which the host handles as it would any later step's.