https://github.com/vbrazo/update-background-locations
A sample iOs example that tracks background locations.
https://github.com/vbrazo/update-background-locations
background battery location swift timer tracker
Last synced: 3 months ago
JSON representation
A sample iOs example that tracks background locations.
- Host: GitHub
- URL: https://github.com/vbrazo/update-background-locations
- Owner: vbrazo
- License: other
- Created: 2016-03-08T21:12:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-30T03:01:06.000Z (about 10 years ago)
- Last Synced: 2025-04-11T10:00:58.462Z (about 1 year ago)
- Topics: background, battery, location, swift, timer, tracker
- Language: Swift
- Homepage:
- Size: 129 KB
- Stars: 7
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iOS Update Background Locations
This is a simple Swift class to provide all the configurations that you need to get background locations.
It's compatible with the latest Swift syntax if you're using any Swift version prior to 2.0.
# If you want to test:
Clone the project and execute in your simulator.
# How to use in your project:
First add BackgroundTasks.swift and Tracker.swift to your project.
Instantiate the class:
```let tracker = LocationController()```
To start the service, configure distanceFilter property. Distance filter is the minimum distance (measured in meters) a device must move horizontally before an update event is generated.:
```tracker.trackingDistance = 100.0```
Set the timer to stop the tracker to save battery (seconds):
```tracker.updateLocationTimer = 10.0```
Set the timer to restart the manager to save battery (seconds):
```tracker.restartTimer = 5.0```
Set the timer to stop the tracker to save battery (seconds):
```tracker.saveBatteryTimer = 5.0```
Set the timer to stop the tracker to save battery (seconds):
``` tracker.startLocationTracking() ```
Don't forget to add the following lines in your plist file:
# Contributing:
I encourage you to contribute to this repository.
# Updated for:
Swift 2.0 (Xcode 7.3)