Asset Tracking Callback
To actively monitor the status of asset tracking and receive crucial location updates via the AssetTracking
framework, you can designate your class as the delegate of the* AssetTracking.shared* instance. This responsibility entails handling callbacks and updates related to asset tracking.
AssetTracking.shared.delegate = self
AssetTrackingCallback Protocol
Here's the protocol definition for AssetTrackingCallback
, outlining the methods you can implement to handle various tracking-related events:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
public protocol AssetTrackingCallback : NSObjectProtocol { /** Called when tracking is started for the specified asset. - Parameter assetId: The ID of the asset that tracking has started for. */ func onTrackingStart(assetId: String) /** Called when tracking is stopped for the specified asset. - Parameter assetId: The ID of the asset that tracking has stopped for. */ func onTrackingStop(assetId: String, trackingDisableType: TrackingDisableType) /** Invoked when new locations are available. */ func onLocationSuccess (location: CLLocation) /** Invoked when an error has occurred. */ func onLocationFailure (error: Error) /** Invoked when try to start tracking with location service off */ func onLocationServiceOff () }
By implementing these callback methods, you can effectively manage asset tracking status and location updates within your iOS application, ensuring a smooth and responsive user experience.