Asset Tracking Callback

这篇文档目前尚未提供译文,将以原文展示。

This section will help users understand and utilize asset-tracking callbacks effectively. By following these steps and implementing the AssetTrackingCallback interface, you can receive valuable updates about location changes, handle errors gracefully, and keep track of when the tracking process starts and stops for a specific asset. Additionally, you have the flexibility to remove the callback when it's no longer required.

Add the Callback

To add a callback, follow these simple steps:

  1. Implement the AssetTrackingCallback interface in your code.

    1class YourClass : AssetTrackingCallback {
    2    // Implement callback methods here
    3}
  2. Add the callback to the AssetTracking instance.

    1    assetTrackingAddCallback(this)

Remove the Callback

When you no longer need the callback, you can easily remove it:

1assetTrackingRemoveCallback(this)

Here's an overview of the available callback methods:

  1. onLocationSuccess(location: Location): This method is invoked when new location information becomes available.

  2. onLocationFailure(exception: Exception): If an error occurs during the tracking process, this method is called to handle the error.

Note: It's important to note that the error message is included in the function callback. Since our SDK is designed to offer flexibility, we refrain from displaying error messages directly to the user interface. Instead, we expect users to override this function to access the provided exception. They can then decide whether to present the relevant error message within their application as required.

  1. onTrackingStart(assetId: String): It is invoked when the tracking process starts for a specified asset, providing you with relevant information.

  2. onTrackingStop(assetId: String): When the tracking process stops for a particular asset, this method is triggered.

  3. onTrackingStop(assetId: String, trackingDisableType: TrackingDisableType): In situations where tracking is stopped for an asset with specific disabled type information, this method provides those details.

By following these steps and understanding the available callback methods, you can effectively incorporate asset-tracking capabilities into your application without needing to be a developer.

HTTP API
Data reporting
没找到你要找的内容?