# Package com.codename1.continuity

package com.codename1.continuity

Saves what the user was doing and brings it back -- after the operating system kills the app, and on the other devices that person owns.

Start at `Continuity`. The framework already knows the `com.codename1.router.Navigation` stack, so an app whose screens carry `@Route` gets them restored with no code; a `StateProvider` adds whatever else matters. `AppState` is the snapshot the two halves make, and it is the same value that is written to storage, advertised to a nearby device and sent through a `StateRelay`.

Referencing this package is what makes the build declare the activity type and compile the native continuation handling in. Its sibling `com.codename1.continuity.sync` is separate because it costs an entitlement on iOS.

See the State Restoration and Continuity chapter of the developer guide for the platform capability table, the build hints and the relay contract.

- Related Packages
  Package
  Description
  com.codename1.continuity.spi
  The platform seam of the continuity framework.
  com.codename1.continuity.sync
  A small key/value store the platform carries between the devices one person is signed in to, for the handful of durable choices that should follow them everywhere.
- Class
  Description
  AppState
  A snapshot of where the user was and what they were doing: the route stack, plus whatever your `StateProvider` chose to add.
  Continuity
  Saves what the user was doing, brings it back when the app starts again, and -- where the platform or your own endpoint can carry it -- lets them pick it up on another device.
  ContinuityListener
  Notified when a state arrives from somewhere other than this device's own storage: one of the user's other devices handed off what they were doing, or a `StateRelay` produced something newer than what is here.
  RestStateRelay
  A `StateRelay` over your own HTTPS endpoint, which is all most applications need.
  StateCodec
  Turns an `AppState` into the two forms it has to travel in, and refuses payloads that cannot make the trip.
  StateProvider
  Supplies and consumes the half of the application state the framework cannot work out for itself.
  StateRelay
  Carries state between devices the platform will not carry it between -- an iPhone and an Android tablet, two devices that are never in the same room, a phone and the web build.