Skip to content

Quickstart

Four steps to your first fix: install → configure → start → subscribe. Pick your platform once — the tabs stay synced as you read.

app/build.gradle.kts
dependencies {
implementation("io.github.beekonlabs:beekon:0.1.1")
}

minSdk 26, JDK 17, Kotlin 2.x. Maven Central is included by default — no extra repository needed.

configure is optional — call it before start() to set the gate. Without it, Beekon uses sensible defaults (30 s / 100 m, balanced, pause). Every field is documented on Configuration.

There’s no initialize(...) — the SDK auto-initializes via AndroidX Startup. Call configure once in Application.onCreate.

import in.wayq.beekon.Beekon
import in.wayq.beekon.BeekonConfig
class App : Application() {
override fun onCreate() {
super.onCreate()
Beekon.configure(
BeekonConfig.SelfManaged(
minTimeBetweenLocationsSeconds = 30,
minDistanceBetweenLocationsMeters = 100.0,
accuracyMode = AccuracyMode.Balanced,
whenStationary = StationaryMode.Pause,
notification = NotificationConfig(
title = "Tracking location",
text = "Capturing your trip",
),
),
)
}
}

start() brings up the platform’s background machinery (Android foreground service, iOS CLBackgroundActivitySession). On native it’s suspend/async and never throws — a missing permission or a platform refusal surfaces as Stopped(reason) on the state stream, not an exception.

lifecycleScope.launch {
Beekon.start() // never throws
}

The locations stream delivers each admitted fix. Consume it the idiomatic way for your platform.

// locations is a SharedFlow (replay 1, DROP_OLDEST)
Beekon.locations.collect { loc ->
Log.d("beekon", "${loc.latitude}, ${loc.longitude} acc=${loc.accuracy ?: "—"}m")
}
// observe why tracking stopped, if it does
Beekon.state.collect { s ->
if (s is BeekonState.Stopped) when (s.reason) {
StopReason.PermissionDenied -> { /* request permission, then start() again */ }
StopReason.LocationServicesDisabled -> { /* Location Services off */ }
else -> {}
}
}

That’s the whole loop. Fixes also land in an on-device SQLite history that survives process death — read ranges with getLocations(from, to). See Locations & history.

  1. Wire the OS-level config: Platform setup.
  2. Tune the gate: every field on Configuration.
  3. Send fixes to your backend — turn on sync and build the ingest endpoint.
  4. Read Lifecycle & states — the state machine behind state.