Skip to content

Quickstart

This page walks through install, configure, start, and observing positions on every platform. Pick your platform once — the tabs stay synced as you scroll.

The platform-specific OS configuration (manifest, plist, pubspec) is in the per-platform setup deep-dives:

  • Android setup — permissions, foreground service notification
  • iOS setup — Info.plist keys, background mode
  • Flutter setup — desugaring on API 24–25, both platforms’ native config
app/build.gradle.kts
dependencies {
implementation("io.github.wayqteam:beekon:0.0.1")
}

Min SDK 24, Kotlin 2.x. Maven Central is included by default in AGP — no extra repo needed.

initialize is one-time and idempotent — call it once at app startup. configure is where the preset and any overrides go.

Application.onCreate
class App : Application() {
override fun onCreate() {
super.onCreate()
Beekon.initialize(this)
Beekon.configure(
BeekonConfig(
preset = Preset.Balanced,
notification = NotificationConfig(
channelId = "beekon-tracking",
channelName = "Tracking",
notificationId = 7411,
title = "Beekon",
text = "Tracking your location",
smallIcon = R.drawable.ic_stat_beekon,
),
),
)
}
}

Android requires a foreground-service notification. The NotificationConfig is mandatory — see Background execution for what each field is used for.

start() requests location updates and brings up the platform’s background-execution machinery (Android foreground service, iOS background activity session). It throws if permission is missing or the platform refuses.

lifecycleScope.launch {
try {
Beekon.start()
} catch (e: BeekonError.PermissionDenied) {
// request ACCESS_FINE_LOCATION + ACCESS_BACKGROUND_LOCATION, then retry
} catch (e: BeekonError.NoGmsAvailable) {
// device has no Google Play Services — Beekon v1 doesn't support non-GMS
}
}

State and positions are streamed; consume with whatever’s idiomatic for your platform.

// Latest state, replay-1
val state by Beekon.state.collectAsStateWithLifecycle()
// Position stream — replay-1, DROP_OLDEST, buffer 64
LaunchedEffect(Unit) {
Beekon.positions.collect { p ->
Log.d("beekon", "${p.lat}, ${p.lng} acc=${p.accuracy}m")
}
}

History is the native library’s own SQLite database. It survives process death; the live position stream does not.

val now = Instant.now()
val hourAgo = now.minus(1, ChronoUnit.HOURS)
val points: List<Position> = Beekon.history(from = hourAgo, to = now)

Retention is TTL 7 days + 100,000 row cap, auto-pruned on each write batch — the same on every platform. See Persistence & history for the schema.

  1. Wire OS-level config: Android, iOS, or Flutter.
  2. Read Lifecycle & states — the state machine that drives state.
  3. Read Background execution for what’s actually keeping your app alive.