Skip to content

vbrazo/Update-Background-Locations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A sample iOs example that tracks background locations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages