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.
1AssetTracking.shared.delegate = self
AssetTrackingCallback Protocol
Here's the protocol definition for AssetTrackingCallback
, outlining the methods you can implement to handle various tracking-related events:
1public protocol AssetTrackingCallback : NSObjectProtocol {
2
3 /**
4 Called when tracking is started for the specified asset.
5 - Parameter assetId: The ID of the asset that tracking has started for.
6 */
7 func onTrackingStart(assetId: String)
8
9 /**
10 Called when tracking is stopped for the specified asset.
11 - Parameter assetId: The ID of the asset that tracking has stopped for.
12 */
13 func onTrackingStop(assetId: String, trackingDisableType: TrackingDisableType)
14
15 /**
16 Invoked when new locations are available.
17 */
18 func onLocationSuccess (location: CLLocation)
19
20 /**
21 Invoked when an error has occurred.
22 */
23 func onLocationFailure (error: Error)
24
25 /**
26 Invoked when try to start tracking with location service off
27 */
28 func onLocationServiceOff ()
29
30}
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.