Docs/API Reference/OctetSdk

OctetSdk

The handle returned by Octet.start(...). Holds the predicate surface (loc) and a snapshot of license state (licenseStatus), and exposes close().

Shape

public final class OctetSdk: @unchecked Sendable {
    public let loc: OctetLoc
    public internal(set) var licenseStatus: LicenseStatus?
    public func close() async                        // release + stop all activity
}
class OctetSdk {
    val loc: OctetLoc
    var licenseStatus: LicenseStatus?
        internal set
    fun close()                               // release + stop all activity
}

licenseStatus is optional in the type. Callers that obtained sdk via Octet.start(...) always see a non-nil value, since start attaches it before returning.

loc. The predicate surface.

OctetSdk.loc is the only way to issue a predicate query. See Predicates for isWithin, isOutside, contains.

close(). Teardown.

close() releases every resource the handle holds and stops all background work: the location and sensor session, the Android location foreground service, and the license heartbeat. It is async on iOS and synchronous on Android. After close() the handle is spent, and a predicate call on it returns INDETERMINATE. See Session Lifecycle.

licenseStatus. Current license snapshot.

Read synchronously at any time. See License Types for the field shape.

if let status = sdk.licenseStatus {
    print("\(status.state): \(status.daysUntilHardStop ?? -1) days left")
}
sdk.licenseStatus?.let { status ->
    println("${status.state}: ${status.daysUntilHardStop ?: -1} days left")
}

Lifecycle notes

  • Call close() to end the session and stop all background work. After close() the handle is spent. See Session Lifecycle.
  • Calling Octet.start(...) a second time within the same process is not supported. Hold the first OctetSdk for as long as you need predicates, then close() it.
  • OctetSdk is Sendable (Swift) and thread-safe to use from any coroutine context (Kotlin). The predicates serialize internally.

See also