Activity detection fills the activity field of each location. For the rest of the Location type, see Locations & history.
By default, activity is null. Set detectActivity = true in your config and Beekon labels each location with the device’s physical activity. It is off by default because it costs battery and needs a second OS permission.
When on, activity carries one of six values: Stationary, Walking, Running, Cycling, Automotive, Unknown. It stays null whenever detection can’t run: it is off, the permission isn’t granted, or (on Android) the device has no Google Mobile Services.
Beekon.configure( BeekonConfig.Local(tracking = TrackingConfig(detectActivity = true)))
Beekon.locations.collect { loc -> Log.d("beekon", "moving as ${loc.activity ?: "—"}")}try await Beekon.shared.configure( BeekonConfig.local(tracking: TrackingConfig(detectActivity: true)))
for await loc in await Beekon.shared.locations { print("moving as \(loc.activity.map { "\($0)" } ?? "—")")}await Beekon.instance.configure( BeekonConfig.local(tracking: const TrackingConfig(detectActivity: true)),);
Beekon.instance.locations.listen((loc) { print('moving as ${loc.activity ?? "—"}');});await Beekon.configure({ mode: 'local', tracking: { detectActivity: true } });
Beekon.onLocation((loc) => console.log('moving as', loc.activity ?? '—'));activity is also sent in the upload payload, on each locations[] entry. It is left out when detection is off.