Core objects & lifecycle
Android Java SDK: Core objects & lifecycle
Core objects & lifecycle
Sdk owns the process SDK session, sdk.exo() returns the Exo domain, and exo.device(name) selects a configured device. ReadChannel<ExoTelemetry> and ReadChannel<ExoStatus> read data; StateChannel<ExoHaptics> also supports writes.
Lifecycle order
- Obtain USB permission, configure an explicit port in
ExoConfig, and construct the SDK on a worker. - Select the device, read its information, and call
device.start()orexo.start(). - Choose background, calling-thread or manual operation; do not run duplicate loops.
- When finished, close the SDK on a worker thread. To stop a background runner while keeping the SDK open, call
requestStop()andjoin()before restarting it.
stop() stops the current connection. With background operation, request stop and join() to finish disconnection/cleanup before checking state or reconnecting with start(). Reconnection does not replay haptics. device.close() closes its source/subscriptions; exo.close() closes the domain while leaving other domains and the SDK root usable. SDK close releases all resources and the accepted host transport.
Use one SDK instance per process with explicit ownership across Activity recreation. Keep blocking join/close off the main thread and out of callbacks. Exo has no independent connect(), disconnect(), calibration, firmware-maintenance or raw-protocol API.