A SwiftUI demo application for the Background Geolocation SDK for iOS.
- Real-time GPS tracking
- Motion detection (stationary/moving states)
- Activity recognition
- Geofencing
- Background location updates
- Location history with SQLite persistence
- Configurable tracking parameters
- Debug logging
- iOS 14.0+
- Xcode 14+
- Swift 5.5+
- Clone the repository:
git clone https://github.com/transistorsoft/background-geolocation-swift-demo.git
cd background-geolocation-swift-demo- Open the project in Xcode:
pod install
open BGGeoSwift.xcworkspace-
Install the Background Geolocation SDK (if not already included)
-
Build and run the project on your device
- Enable Tracking: Toggle the tracking switch to start location updates
- Motion State: Use the play/pause button to simulate moving/stationary states
- Get Current Position: Fetch a single location update
- Menu Actions: Access additional features like resetting odometer, viewing state, and managing logs
The app is configured in ContentView.swift in the configureBGGeoIfNeeded() method:
desiredAccuracy: Location accuracy settingdistanceFilter: Minimum distance for location updatesstopOnTerminate: Continue tracking after app terminationstartOnBoot: Auto-start tracking on device boot
Transistor Software
MIT