Device APIs

getSystemInfo

Get system information.

Overview

my.getSystemInfo retrieves the system information of the current device, including model, operating system version, screen resolution, and other device characteristics.

Sample Code

my.getSystemInfo({
  success: (res) => {
    console.log(res.model);
    console.log(res.pixelRatio);
    console.log(res.windowWidth);
    console.log(res.windowHeight);
    console.log(res.language);
    console.log(res.version);
    console.log(res.platform);
  },
});

Parameters

PropertyTypeRequiredDescription
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

PropertyTypeDescription
modelStringDevice model.
pixelRatioNumberDevice pixel ratio.
windowWidthNumberWindow width in px.
windowHeightNumberWindow height in px.
languageStringSystem language.
versionStringVersion number.
storageStringStorage capacity of the device.
currentBatteryStringCurrent battery level.
systemStringSystem version.
platformStringSystem platform.
titleBarHeightStringTitle bar height.
statusBarHeightStringStatus bar height.
screenWidthNumberScreen width in px.
screenHeightNumberScreen height in px.
brandStringDevice brand.
fontSizeSettingNumberUser font size setting.
appStringHost app name.
safeAreaObjectSafe area information.

Usage Notes

  • Asynchronously obtains comprehensive device information via the success callback
  • All measurements in pixels (px)
  • Returns both window and screen dimensions
  • Useful for responsive design and device-specific features
  • Safe area information helps with notch and gesture bar handling