All Projects → sobri909 → Locokit

sobri909 / Locokit

Licence: lgpl-3.0
Location, motion, and activity recording framework for iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Locokit

roam-reactnative
React Native Location SDK. High accuracy and battery efficient location SDK for iOS and Android by Roam.ai
Stars: ✭ 20 (-98.52%)
Mutual labels:  gps, location
android-amap-track-collect
这阵子由于项目需要,需要从手机上采集用户的运动轨迹数据,这样的功能大家都见到的很多了,比如咕咚、悦动圈,对跑步运动轨迹数据进行采集,再如,微信运动、钉钉运动,对于每一天你走步进行计数,如果要记录轨迹就离不开的手机定位,如果要记录步数那就离不开陀螺仪(角速度传感器),花了一天多的时间实现了一个定位数据实时采集的功能。
Stars: ✭ 50 (-96.3%)
Mutual labels:  gps, location
gps-share
Utility to share your GPS device on local network
Stars: ✭ 49 (-96.38%)
Mutual labels:  gps, location
orange3-geo
🍊 🌍 Orange add-on for dealing with geography and geo-location
Stars: ✭ 22 (-98.37%)
Mutual labels:  gps, location
P5.geolocation
a geolocation and geofencing library for p5.js
Stars: ✭ 75 (-94.46%)
Mutual labels:  gps, location
aic-mobile-ios
Art Institute of Chicago Official Mobile App
Stars: ✭ 29 (-97.86%)
Mutual labels:  gps, location
react-native-device-country
Get device location by telephony (SIM card) or settings without using GPS tracker.
Stars: ✭ 33 (-97.56%)
Mutual labels:  gps, location
FusedBulb
Location fetch library.
Stars: ✭ 22 (-98.37%)
Mutual labels:  gps, location
Indoorgps
Position Calculating with Trilateration via Bluetooth Beacons(Estimote)
Stars: ✭ 59 (-95.64%)
Mutual labels:  gps, location
Rxgps
Finding current location cannot be easier on Android !
Stars: ✭ 307 (-77.31%)
Mutual labels:  gps, location
surger
⚡ Is there surge pricing around me right now?
Stars: ✭ 20 (-98.52%)
Mutual labels:  gps, location
Leaflet Gps
Simple leaflet control plugin for tracking gps position
Stars: ✭ 90 (-93.35%)
Mutual labels:  gps, location
Atlas
🌎 Atlas is a set of APIs for looking up information about locations
Stars: ✭ 21 (-98.45%)
Mutual labels:  gps, location
gpx-builder
Builder of GPX files
Stars: ✭ 25 (-98.15%)
Mutual labels:  gps, location
LocationShare
A simple Android application to share your location
Stars: ✭ 75 (-94.46%)
Mutual labels:  gps, location
telegram-nearby-map
Discover the location of nearby Telegram users 📡🌍
Stars: ✭ 329 (-75.68%)
Mutual labels:  gps, location
Geolocation
Flutter geolocation plugin for Android and iOS.
Stars: ✭ 205 (-84.85%)
Mutual labels:  gps, location
Maps
🌍🌏🌎 The whole world fits inside your cloud!
Stars: ✭ 253 (-81.3%)
Mutual labels:  gps, location
EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (-89.5%)
Mutual labels:  gps, location
Location
Smartphone navigation positionning, fusion GPS and IMU sensors.
Stars: ✭ 87 (-93.57%)
Mutual labels:  gps, location

LocoKit

A Machine Learning based location recording and activity detection framework for iOS.

Location and Motion Recording

  • Combined, simplified Core Location and Core Motion recording
  • Filtered, smoothed, and simplified location and motion data
  • Near real time stationary / moving state detection
  • Automatic energy use management, enabling all day recording
  • Automatic stopping and restarting of recording, to avoid wasteful battery use

Activity Type Detection

  • Machine Learning based activity type detection
  • Improved detection of Core Motion activity types (stationary, walking, running, cycling, automotive)
  • Distinguish between specific transport types (car, train, bus, motorcycle, airplane, boat)

Record High Level Visits and Paths

  • Optionally produce high level Path and Visit timeline items, to represent the recording session at human level. Similar to Core Location's CLVisit, but with much higher accuracy, much more detail, and with the addition of Paths (ie the trips between Visits).
  • Optionally persist your recorded samples and timeline items to a local SQL based store, for retention between sessions.

More information about timeline items can be found here

Supporting the Project

LocoKit is an LGPL licensed open source project. Its ongoing development is made possible thanks to the support of its backers on Patreon.

If you have an app that uses LocoKit and is a revenue generating product, please consider sponsoring LocoKit development, to ensure the project that your product relies on stays healthy and actively maintained.

Thanks so much for your support!

Installation

pod 'LocoKit'
pod 'LocoKit/LocalStore' # optional

Note: Include the optional LocoKit/LocalStore subspec if you would like to retain your samples and timeline items in the SQL persistent store.

High Level Recording

Record TimelineItems (Paths and Visits)

// retain a timeline manager
self.timeline = TimelineManager()

// start recording, and producing timeline items 
self.timeline.startRecording()

// observe timeline item updates
when(timeline, does: .updatedTimelineItem) { _ in
    let currentItem = timeline.currentItem

    // duration of the current Path or Visit
    print("item.duration: \(currentItem.duration)")

    // activity type of the current Path (eg walking, cycling, car)
    if let path = currentItem as? Path {
        print("path.activityType: \(path.activityType)")
    }

    // examine each of the LocomotionSamples within the Path or Visit
    for sample in currentItem.samples {
        print("sample: \(sample)")
    }
}

Low Level Recording

Record LocomotionSamples (CLLocations combined with Core Motion data)

// the recording manager singleton
let loco = LocomotionManager.highlander
// decide which Core Motion features to include
loco.recordPedometerEvents = true
loco.recordAccelerometerEvents = true
loco.recordCoreMotionActivityTypeEvents = true
// decide whether to use "sleep mode" to allow for all day recording 
loco.useLowPowerSleepModeWhileStationary = true

Note: The above settings are all on by default. The above snippets are unnecessary, and just here to show you some of the available options.

// start recording 
loco.startRecording()
// watch for updated LocomotionSamples
when(loco, does: .locomotionSampleUpdated) { _ in

    // the raw CLLocation
    print(loco.rawLocation)

    // a more usable, de-noised CLLocation
    print(loco.filteredLocation)

    // a smoothed, simplified, combined location and motion sample
    print(loco.locomotionSample())
}

Fetching TimelineItems / Samples

If you wanted to get all timeline items between the start of today and now, you might do this:

let date = Date() // some specific day
let items = store.items(
        where: "deleted = 0 AND endDate > ? AND startDate < ? ORDER BY endDate",
        arguments: [date.startOfDay, date.endOfDay])

You can also construct more complex queries, like for fetching all timeline items that overlap a certain geographic region. Or all samples of a specific activity type (eg all "car" samples). Or all timeline items that contain samples over a certain speed (eg paths containing fast driving).

Detect Activity Types

Note that if you are using a TimelineManager, activity type classifying is already handled for you by the manager, on both the sample and timeline item levels. You should only need to directly interact with clasifiers if you are either not using a TimelineManager, or are wanting to do low level processing at the sample level.

// fetch a geographically relevant classifier
let classifier = ActivityTypeClassifier(coordinate: location.coordinate)

// classify a locomotion sample
let results = classifier.classify(sample)

// get the best match activity type
let bestMatch = results.first

// print the best match type's name ("walking", "car", etc)
print(bestMatch.name)

Note: The above code snippets use SwiftNotes to make the event observing code easier to read. If you're not using SwiftNotes, your observers should be written something like this:

let noteCenter = NotificationCenter.default
let queue = OperationQueue.main 

// watch for updates
noteCenter.addObserver(forName: .locomotionSampleUpdated, object: loco, queue: queue) { _ in
    // do stuff
}

Background Location Monitoring

If you want the app to be relaunched after the user force quits, enable significant location change monitoring.

More details and requirements here

Examples and Screenshots

Documentation

Try the LocoKit Demo App

  1. Download or clone this repository
  2. pod install
  3. In Xcode, change the Demo App project's "Team" to match your Apple Developer Account
  4. In Xcode, change the Demo App project's "Bundle Identifier" to something unique
  5. Build and run!
  6. Go for a walk, cycle, drive, etc, and see the results :)

Try Arc App on the App Store

  • To see the SDK in action in a live, production app, install Arc App from the App Store, our free life logging app based on LocoKit
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].