PWLocation SDK for iOS
This is Phunware's Location SDK for use with its Multiscreen-as-a-Service platform. It provides indoor/outdoor positioning capabilities for venues. Visit http://maas.phunware.com for more details and to sign up.
Requirements
- PWCore 3.12.x
- iOS 13.0 or greater
- Xcode 13.0 or greater
Installation
CocoaPods
It is required to use CocoaPods 1.10 or greater to integrate the framework. Simply add the following to your Podfile:
pod 'PWLocation'
Documentation
Documentation is included in the Documents folder in the repository as both HTML and as a .docset. You can also find the latest documentation here: http://phunware.github.io/maas-location-ios-sdk
Integration
PWLocation is meant to be used as a dependency to PWMapKit, but can be used as a standalone SDK.
PWCore
PWCore configuration is required to use any location provider in PWLocation. In the MaaS portal, retrieve your application identifier, signature key, access key, and encryption key (if you have one). In your application's delegate, add the following:
PWCore.setApplicationID("APPLICATION_ID",
accessKey: "ACCESS_KEY",
signatureKey: "SIGNATURE_KEY")
Location Permissions
Location authorization of "When In Use" or "Always" is required for a PWLocationManager to function normally. Please follow Apple's Best Practices for requesting location permissions. Do not attempt to use a PWLocationManager if the user does not provide location authorization as this can lead to unexpected behavior.
PWManagedLocationManager
PWManagedLocationManager
is a class that takes a location update from one of the other location providers and uses an algorithm to improve the accuracy of that location before returning it to the consumer.
PWManagedLocationManager
relies on a building bundle that is created by the MaaS server. The building is configured in the MaaS portal, and the building identifier will be found in those portal configuration pages.
To create a PWManagedLocationManager
, call its initWithBuildingId:
function and pass it the desired building identifier. Finally, call startUpdatingLocation
on the PWManagedLocationManager
object. The manager will fetch and parse the required server bundles and begin giving location updates as soon as possible.
// Initialize the manager
let manager = PWManagedLocationManager(buildingId: <BUILDING_IDENTIFIER>)
manager.delegate = self
// Start fetching location updates
manager.startUpdatingLocation()
Location Updates
Location updates are returned via the delegate. Update events are very similar to CLLocationManagerDelegate
events.
func locationManager(_ manager: PWLocationManager!, didUpdateTo location: PWLocationProtocol!) {
// Handle update
}
func locationManager(_ manager: PWLocationManager!, failedWithError error: Error!) {
// Handle failure
}
Privacy
You understand and consent to Phunware’s Privacy Policy located at www.phunware.com/privacy. If your use of Phunware’s software requires a Privacy Policy of your own, you also agree to include the terms of Phunware’s Privacy Policy in your Privacy Policy to your end users.
Terms
Use of this software requires review and acceptance of our terms and conditions for developer use located at http://www.phunware.com/terms