Skip to main content

CheckFeature API

CheckFeature API

CheckFeature(apiName, onSuccess, onFail)

Checks in advance whether a specific API is supported on the current platform.

Parameters:

ParameterTypeRequiredDescription
apiNamestringAPI name to check
onSuccessAction<CheckFeatureResult>-Callback when feature is supported
onFailAction<CheckFeatureResult>-Callback when feature is not supported

Success/Failure Response (CheckFeatureResult):

FieldTypeDescription
supportedboolWhether the feature is supported
statusstringReason for not being supported
apiNamestringAPI name that was checked
detailstringDetailed description
StatusEnumCheckFeatureStatusEnum conversion of status

CheckFeatureStatus Options:

ValueDescription
supportedFeature is supported
unknown_apiAPI does not exist in the SDK
version_requiredApp version update required
platform_unsupportedPlatform not supported
device_unsupportedDevice not supported
permission_deniedPermission denied

Note: Both success and failure pass a CheckFeatureResult type. Use the supported field or StatusEnum property to determine support status.

using Tudada;

// Check feature before using
TudadaSDK.Instance.CheckFeature("startAccelerometerSensor",
onSuccess: (result) => {
Debug.Log($"Supported: {result.apiName}");
// Use accelerometer
TudadaSDK.Instance.StartAccelerometerSensor();
},
onFail: (result) => {
Debug.Log($"Not supported: {result.apiName}, reason: {result.status}");
if (result.StatusEnum == CheckFeatureStatus.version_required)
{
// Show update prompt
ShowUpdatePrompt();
}
}
);