CheckFeature API
CheckFeature API
CheckFeature(apiName, onSuccess, onFail)
Checks in advance whether a specific API is supported on the current platform.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
apiName | string | ✅ | API name to check |
onSuccess | Action<CheckFeatureResult> | - | Callback when feature is supported |
onFail | Action<CheckFeatureResult> | - | Callback when feature is not supported |
Success/Failure Response (CheckFeatureResult):
| Field | Type | Description |
|---|---|---|
supported | bool | Whether the feature is supported |
status | string | Reason for not being supported |
apiName | string | API name that was checked |
detail | string | Detailed description |
StatusEnum | CheckFeatureStatus | Enum conversion of status |
CheckFeatureStatus Options:
| Value | Description |
|---|---|
supported | Feature is supported |
unknown_api | API does not exist in the SDK |
version_required | App version update required |
platform_unsupported | Platform not supported |
device_unsupported | Device not supported |
permission_denied | Permission denied |
Note: Both success and failure pass a
CheckFeatureResulttype. Use thesupportedfield orStatusEnumproperty 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();
}
}
);