Skip to content

Lifecycle and online state

Use the supported platform wrapper. Protected UI wrappers return an instance only after an accepted consent result. Create one instance per logical peer and assign a single owner such as an application-level service or controller.

connect() returning success means the connection supervisor started or was already active. Discovery, authentication, and transport setup may still be in progress.

Use one of these online signals:

  • Connected callback.
  • Wrapper connected event.
  • Kotlin lifecycle state or event stream.
  • isOnline / is_online after an event or deliberate poll.

Do not grant rewards, show an active status, or infer usable connectivity from the return value of connect() alone.

The SDK can report Manual, Network, ServerUnavailable, TokenExpired, LowBattery, DiscoveryError, ProtocolError, or Unknown. Policy-driven or network failures may reconnect internally. Application code should update state and telemetry but should not run its own tight reconnect loop.

  • Call disconnect when the logical peer should pause but the object may be reused.
  • Call close(), free(), or Dispose() exactly once at final shutdown.
  • Do not use the instance after final release or successful revoke.
  • Direct native consumers must serialize calls and clear callbacks before freeing managed callback state.

Android and iOS wrappers marshal callbacks onto configured application queues. Node emits events on the JavaScript event loop. C callbacks can run on SDK runtime threads. Keep every handler short and move blocking work to an application-owned worker.

After close/free/dispose, the instance is terminal. Reconnecting requires a new SDK instance created through the current consent state.