OctetSdk
The handle returned by Octet.start(...). Holds the predicate surface (loc), read-only remote configuration (flags) and a snapshot of license state (licenseStatus), and exposes close().
Shape
public final class OctetSdk: @unchecked Sendable {
public let loc: OctetLoc
// flags: read-only remote configuration (see `flags` below)
public internal(set) var licenseStatus: LicenseStatus?
public func close() async // release + stop all activity
}
class OctetSdk {
val loc: OctetLoc
// flags: read-only remote configuration (see `flags` below)
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
OctetSdk.loc is the only way to issue a predicate query. See Predicates for isWithin, isOutside, contains.
close()
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
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")
}
flags
Read-only remote configuration. getBoolean(key, default), getInt(key, default), getString(key, default) and getAssignment(experiment) read a signed bundle that the SDK fetches at start and refreshes on each heartbeat. An unknown or wrong-typed key, a missing bundle, or a disabled subsystem returns the default you pass. Set OctetConfig.flagsEnabled = false to turn it off.
Lifecycle notes
- Calling
Octet.start(...)a second time within the same process is not supported. Hold the firstOctetSdkfor as long as you need predicates, thenclose()it. OctetSdkisSendable(Swift) and thread-safe to use from any coroutine context (Kotlin). The predicates serialize internally.
See also
Octet.start(...). How to obtain anOctetSdk.- Predicates. The methods on
sdk.loc. OctetVerdict. What predicates return.