Location
Overview
While data fetching from the server does not depend much on the location, it is important to have a good location to track turbulence data. Cellular devices have a built-in GPS and can have a stable location without an internet connection, but WiFi-only devices do not and need an internet connection or an external GPS receiver. When a device has poor location data (outdated or invalid) SDK will not track data and show the current position on the map. However, SDK tries to operate with a poor or shaky GPS signal as much as possible. SDK handles all location-related stuff out of the box.
Error
SkyPathDelegate.didFail(with:dataType:) could be called when SDK failed to get a location when, for example, a GPS signal is not available, or location usage permission has not been granted for the app. Location errors are not data type specific, so dataType is nil and the error is a GeneralError.location(error:).
func didFail(with error: SPError, dataType: DataType?) {
if case GeneralError.location = error {
// handle the location error
}
}
Low Power Mode
SDK tracks the best accuracy location when in flight to correctly track turbulence data. When the location is not needed anymore (when landed) and the app is left in the background or foreground, SDK can stop location tracking and switch to low power mode to save battery. Location tracking will start for the next flight.
This is handled by the SDK internally, and the low power mode state is not reported to the app.
Pressure Altitude
Enables calculated pressure altitude for self.
SkyPath.shared.useCalculatedPressureAltitudeForSelf = true
When false (default), the iPad's GPS will be used for self-altitude.
When true, barometric pressure data will be used to calculate self-altitude.
Can be enabled and disabled at any time.
Self-altitude is used for example in Turbulence Notifications to search within the vertical corridor.
When true, baro forecast data will be periodically fetched from the server, and increase network traffic.
Location Injection
When the app has a location from an external source it can inject it into SDK to use it prioritized over the device's location.
Inject external location whenever the update is received.
let externalLocation = InjectedLocation(
location: newLocation,
altitude: .gps(altitude: newLocation.altitude))
SkyPath.shared.inject(location: externalLocation)
Pass only a real location received from an external source.