The following classes are available globally.
The central class for interacting with LocoKit location and motion recording. All actions should be performed on the
LocomotionManager monitors raw device location and motion data and applies filtering and smoothing algorithms to produce a stream of high level
LocomotionSampleobjects, a composite representation of the device and user’s location and activity state at each point in time.
Locomotion samples include filtered and smoothed locations, the user’s moving or stationary state, current activity type (eg walking, running, cycling, etc), step hertz (ie walking, running, or cycling cadence), and more.
LocomotionManager dynamically adjusts various device monitoring parameters, balancing current conditions and desired results to achieve the desired accuracy in the most energy efficient manner.
Starting and Stopping Recording
To start recording location and motion data call
startRecording(), and call
LocomotionManager will send
locomotionSampleUpdatednotifications via the system default NotificationCenter when each new location arrives.
Raw, Filtered, and Smoothed Data
LocoKit provides three levels of location data: Raw CLLocations, filtered CLLocations, and high level location and activity state LocomotionSamples. See the documentation for
LocomotionSamplefor details on each.
When each raw location arrives LocomotionManager updates its determination of whether the user is moving or stationary, based on changes between current and previous locations over time. The most up to date determination is available either from theSee more
movingStateproperty on the LocomotionManager, or on the latest
locomotionSample. See the
movingStatedocumentation for further details.
@objc public class LocomotionManager: NSObject
A composite, high level representation of the device’s location, motion, and activity states over a brief duration of time.
The current sample can be retrieved from
Dynamic Sample Sizes
Each sample’s duration is dynamically determined, depending on the quality and quantity of available ocation and motion data. Samples sizes typically range from 10 to 60 seconds, however varying conditions can sometimes produce sample durations outside those bounds.
Higher quality and quantity of available data results in shorter sample durations, with more specific representations of single moments in time.
Lesser quality or quantity of available data result in longer sample durations, thus representing the average or most common states and location over the sample period instead of a single specific moment.See more
open class LocomotionSample: ActivityTypeTrainable, TimelineObject, Codable
public class TimelineStoreCacheDelegate: NSObject, NSCacheDelegate