Skip to main content

CheckFeature API

CheckFeature API

checkFeature(options)

Checks in advance whether a specific API is supported on the current platform. APIs that do not exist in the SDK fail immediately without platform communication.

Options:

ParameterTypeRequiredDescription
apiNamestringName of the API to check
successfunction-Callback when the feature is supported
failfunction-Callback when the feature is unsupported
completefunction-Completion callback

Success Response:

FieldTypeDescription
supportedtrueFeature is supported
status'supported'Support status
apiNamestringName of the checked API

Failure Response:

FieldTypeDescription
supportedfalseFeature is not supported
statusstringReason for lack of support
apiNamestringName of the checked API
detailstring?Detailed description

status Values:

ValueDescription
'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
TudadaSDK.checkFeature({
apiName: 'startAccelerometerSensor',
success: (res) => {
console.log('Supported:', res.apiName);
},
fail: (res) => {
console.log('Unsupported:', res.status);
if (res.status === 'version_required') {
showUpdatePrompt(); // Show in-game update prompt
}
},
});

checkFeatureAsync(apiName)

Promise-based feature check. Both supported and unsupported results are returned via resolve.

Parameters:

ParameterTypeRequiredDescription
apiNamestringName of the API to check

Return Value:

FieldTypeDescription
supportedbooleanWhether the feature is supported
statusstringSupport status or reason for lack of support
apiNamestringName of the checked API
detailstring?Detailed description (when unsupported)
const result = await TudadaSDK.checkFeatureAsync('startAccelerometerSensor');
if (result.supported) {
TudadaSDK.startAccelerometerSensor();
} else {
console.log('Unsupported reason:', result.status);
}