Last Updated on : 2024-07-01 08:14:29download
Travel products offer a range of advanced features to users. Most of these features are free for the first year and require renewal the following year to continue access to all features. Without renewal, end users can only access basic features. For a combo device, only Bluetooth is available, while for a cellular device, all features will be disabled.
You can use the following method to verify the logic for the value-added services.
Class (protocol) | Description |
---|---|
IODValueAddedServicesManager | The value-added services. |
ODValueAddedServicesModel | The model for the value-added services. |
Check if the value-added service for an end user is valid. If the service has expired, disable the paid advanced value-added services and guide the end user to renewal.
API description
/**
* Get value-added service information based on device ID
*
* @param devId device ID
* @param listener callback
*/
fun fetchValueAddedServicesWithDevID(
devId: String,
listener: IThingResultCallback<ODValueAddedServicesModel?>
)
Example
OutdoorUtils.fetchValueAddedServicesWithDevID(deviceId, new IThingResultCallback<ODValueAddedServicesModel>() {
@Override
public void onSuccess(ODValueAddedServicesModel result) {
showToast("success");
}
@Override
public void onError(String errorCode, String errorMessage) {
showToast("onError code=" + errorCode + " message=" + errorMessage);
}
});
ODValueAddedServicesModel
data model
@Keep
data class ODValueAddedServicesModel(
// Required, the device UUID
val uuid: String,
// Required, the device ID
val devId: String,
// The capability set.
val abilityMap: Map<String, DeviceValuesAddStatusBean>? = mutableMapOf(),
)
@Keep
data class DeviceValuesAddStatusBean(
// Required, the code for the value-added service capability. See the description of new constants.
val externalCode: String,
// Required. `true` indicates that the advanced capabilities for travel or navigation are valid. `false` indicates that the advanced capabilities for travel or navigation are invalid. When the value is `false`, the following fields are empty.
val isPidHadVAS: Boolean?,
// Optional, the URL for value-added service purchase.
val commodityUrl: String?,
// Optional, the end time of the value-added service.
val effectiveEndDate: Long = -1,
// Optional, the start time of the value-added service.
val effectiveStartDate: Long = -1,
// Optional. `true` indicates the pop-up window appears. `false` indicates the pop-up window does not appear. This notification only applies when end users have activated the advanced capabilities for travel products. You can ignore this field for the navigation value-added service.
var hadPopup: Boolean = false,
// Optional. `true` indicates the value-added service is valid. `false` the value-added service is invalid due to expiration or non-purchase.
val inService: Boolean?,
// Optional. This parameter has a value when `inService` is true. The service provider: `god` for Tuya Smart, and `brand` for the brand owner.
val serviceProvider: String?
) {
fun getIsPidHadVAS(): Boolean? {
return isPidHadVAS
}
}
Example of response parameters
{
"abilityMap": {
"outdoor_data_cloud_store": {
"commodityUrl": "url",
"effectiveEndDate": 12213213213,
"effectiveStartDate": 12213213213,
"externalCode": "outdoor_data_cloud_store",
"hadPopup": false,
"inService": true,
"isPidHadVAS": true,
"serviceProvider": "brand"
},
"travel_mapbox": {
"commodityUrl": "url",
"effectiveEndDate": 12213213213,
"effectiveStartDate": 12213213213,
"externalCode": "travel_mapbox",
"hadPopup": false,
"inService": true,
"isPidHadVAS": true,
"serviceProvider": "brand"
},
"outdoor_track_record_090_day": {
"commodityUrl": "url",
"effectiveEndDate": 12213213213,
"effectiveStartDate": 12213213213,
"externalCode": "outdoor_track_record_090_day",
"hadPopup": false,
"inService": true,
"isPidHadVAS": true,
"serviceProvider": "brand"
}
},
"devId": "1234",
"uuid": "1234"
}
externalCode
is the code for the value-added service.
outdoor_data_cloud_store Cloud storage.
outdoor_track_record_007_day 7-day route retention.
outdoor_track_record_030_day 30-day route retention.
outdoor_track_record_090_day 90-day route retention.
outdoor_track_record_180_day 180-day route retention.
outdoor_track_record_365_day 365-day route retention.
outdoor_riding_voice_broadcast Ride voice announcements.
Check if the renewal pop-up window appears. If it appears, this method will be invoked in the callback for closing the pop-up window to update hadPopup
in ODValueAddedServicesModel
.
API description
/**
* Set the status of the value-added service pop-up box
*
*
* @param devId device ID
* @param hadPopup Reset the pop-up status
* @param listener callback
*/
fun setValueAddedServicesPopWithDevID(devId: String,hadPopup:Boolean, listener: IThingResultCallback<Boolean?>)
Example
OutdoorUtils.setValueAddedServicesPopWithDevID(deviceId, true, new IThingResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
showToast("success");
}
@Override
public void onError(String errorCode, String errorMessage) {
showToast("onError code=" + errorCode + " message=" + errorMessage);
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback