Skip to main content

System API

System API

Retrieves device and system information.

getSystemInfoSync()

Synchronously retrieves full system information.

Return Value:

FieldTypeDescription
platformstringPlatform ('ios' | 'android')
brandstringDevice brand
modelstringDevice model
systemstringOS and version
pixelRationumberDevice pixel ratio
screenWidthnumberScreen width (px)
screenHeightnumberScreen height (px)
windowWidthnumberAvailable window width (px)
windowHeightnumberAvailable window height (px)
safeAreaSafeAreaSafe area information
languagestringLanguage setting
themestringTheme ('light' | 'dark')
deviceOrientationstringScreen orientation ('portrait' | 'landscape')
SDKVersionstringSDK version
versionstringService version
environmentstringAccess environment ('prod' | 'dev'). Can be used for switching resource CDN addresses, etc.
benchmarkLevelnumberPerformance level (Android)
wifiEnabledbooleanWi-Fi enabled status
const info = TudadaSDK.getSystemInfoSync();
console.log('Platform:', info.platform);
console.log('Screen:', info.windowWidth, 'x', info.windowHeight);
console.log('SafeArea:', info.safeArea);

getSystemInfo(options?)

Asynchronously retrieves full system information.

Options:

ParameterTypeRequiredDescription
successfunction-Success callback
failfunction-Failure callback
completefunction-Completion callback

Success Response:

Same as the return value of getSystemInfoSync().

TudadaSDK.getSystemInfo({
success: (res) => console.log('System info:', res),
});

Tip: You can use the environment field to switch resource CDN addresses per environment.

const info = TudadaSDK.getSystemInfoSync();
const cdnBase = info.environment === 'prod'
? 'https://cdn.example.com/prod'
: 'https://cdn.example.com/dev';

getWindowInfo()

Synchronously retrieves window/screen size and SafeArea information.

Return Value:

FieldTypeDescription
pixelRationumberDevice pixel ratio
screenWidthnumberScreen width (px)
screenHeightnumberScreen height (px)
windowWidthnumberAvailable window width (px)
windowHeightnumberAvailable window height (px)
safeAreaSafeAreaSafe area information
const windowInfo = TudadaSDK.getWindowInfo();
console.log('SafeArea:', windowInfo.safeArea);
console.log('Pixel ratio:', windowInfo.pixelRatio);

getWindowInfoAsync(options?)

Asynchronously retrieves window/screen size and SafeArea information.

Options:

ParameterTypeRequiredDescription
successfunction-Success callback
failfunction-Failure callback
completefunction-Completion callback

Success Response:

Same as the return value of getWindowInfo().

SafeArea Structure:

FieldTypeDescription
leftnumberTop-left X coordinate
topnumberTop-left Y coordinate
rightnumberBottom-right X coordinate
bottomnumberBottom-right Y coordinate
widthnumberSafe area width
heightnumberSafe area height

getAppBaseInfo()

Synchronously retrieves app/SDK basic information.

Return Value:

FieldTypeDescription
SDKVersionstringSDK version
versionstringService version
themestringTheme ('light' | 'dark')
languagestringLanguage setting
environmentstringAccess environment ('prod' | 'dev')
const appInfo = TudadaSDK.getAppBaseInfo();
console.log('SDK version:', appInfo.SDKVersion);
console.log('Theme:', appInfo.theme);
console.log('Environment:', appInfo.environment); // 'prod' or 'dev'

getAppBaseInfoAsync(options?)

Asynchronously retrieves app/SDK basic information.

Options:

ParameterTypeRequiredDescription
successfunction-Success callback
failfunction-Failure callback
completefunction-Completion callback

Success Response:

Same as the return value of getAppBaseInfo().

getDeviceInfo()

Synchronously retrieves device hardware information.

Return Value:

FieldTypeDescription
brandstringDevice brand
modelstringDevice model
systemstringOS and version
platformstringPlatform ('ios' | 'android')
benchmarkLevelnumberPerformance level (Android)
const deviceInfo = TudadaSDK.getDeviceInfo();
console.log('Brand:', deviceInfo.brand);
console.log('Model:', deviceInfo.model);
console.log('Benchmark level:', deviceInfo.benchmarkLevel);

getDeviceInfoAsync(options?)

Asynchronously retrieves device hardware information.

Options:

ParameterTypeRequiredDescription
successfunction-Success callback
failfunction-Failure callback
completefunction-Completion callback

Success Response:

Same as the return value of getDeviceInfo().