We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick GameRuntime Quick GameSystemSystem Information

System Information

NOTE

Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.

Definition

Expand

API

Description

qg.getSystemInfo(Object object)

Obtains system information.

qg.getSystemInfoSync(Object object)

Obtains system information in synchronous mode.

qg.getSystemInfo(Object object)

  • Description

    Obtains the system information of the mobile phone.

  • Parameters in object
    Expand

    Parameter

    Type

    Mandatory

    Description

    success

    function

    No

    Callback function triggered upon a successful API call. For details, please refer to Parameters in the success callback function.

    fail

    function

    No

    Callback function triggered upon a failed API call.

    complete

    function

    No

    If a function is passed, it will be called regardless of whether the API call succeeds or fails.

    • Parameters in the success callback function
      Expand

      Parameter

      Type

      Description

      brand

      string

      Device brand.

      model

      string

      Device model.

      pixelRatio

      number

      Device pixel ratio.

      NOTE

      To ensure that the obtained pixelRatio matches safeArea, set minPlatformVersion to 1078 or later.

      screenWidth

      number

      Screen width.

      screenHeight

      number

      Screen height.

      windowWidth

      number

      Available window width.

      windowHeight

      number

      Available window height.

      language

      string

      System language.

      region

      string

      System region.

      script

      string

      System language script settings.

      coreVersion

      string

      Version number of the rendering engine.

      COREVersion

      string

      Version number of the rendering engine.

      system

      string

      OS version.

      platform

      string

      Client platform.

      version

      string

      Version number of Quick App Center.

      statusBarHeight

      number

      Status bar height, which is determined by the actual screen resolution.

      platformVersionName

      string

      Platform version name.

      NOTE

      This field is returned only when minPlatformVersion of the quick game is 1078 or later.

      platformVersionCode

      number

      Standard version number of the platform.

      NOTE

      This field is returned only when minPlatformVersion of the quick game is 1078 or later.

      safeArea

      object

      Safe area in the upright portrait orientation. For details, please refer to Parameters in safeArea.

      NOTE

      This field is returned only when minPlatformVersion of the quick game is 1078 or later.

      • Parameters in safeArea
        Expand

        Attribute

        Type

        Description

        bottom

        number

        Vertical coordinate of the lower right corner of the safe area.

        left

        number

        Horizontal coordinate of the upper left corner of the safe area.

        right

        number

        Horizontal coordinate of the lower right corner of the safe area.

        top

        number

        Vertical coordinate of the upper left corner of the safe area.

        height

        number

        Height of the safe area. The value is the actual height (in pixels) divided by the device screen density.

        width

        number

        Width of the safe area. The value is the actual width (in pixels) divided by the device screen density.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. qg.getSystemInfo({
    2. success(res) {
    3. console.log("on getSystemInfo: success =" + JSON.stringify(res));
    4. },
    5. fail() {
    6. console.log("on getSystemInfo: fail");
    7. },
    8. complete() {
    9. console.log("on getSystemInfo: complete");
    10. }
    11. });
  • Returned parameter example
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. "brand":"HUAWEI",
    2. "model":"C*T-A**0",
    3. "pixelRatio":3,
    4. "screenWidth":360,
    5. "screenHeight":746.6666666666666,
    6. "windowWidth":360,
    7. "windowHeight":746.6666666666666,
    8. "language":"zh",
    9. "region":"CN",
    10. "script":"Hans",
    11. "coreVersion":"1.1.21",
    12. "COREVersion":"1.1.21",
    13. "system":"Android 10",
    14. "platform":"ANDROIDOS",
    15. "version":"3.6.1.2",
    16. "statusBarHeight":0,
    17. "platformVersionName":"1.106",
    18. "platformVersionCode":1106,
    19. "safeArea":{
    20. "bottom":746.6666666666666,
    21. "left":0,
    22. "right":360,
    23. "top":0,
    24. "height":746.6666666666666,
    25. "width":360
    26. }

qg.getSystemInfoSync(Object object) (1078+)

  • Description

    Obtains system information in synchronous mode.

  • Returns

    For details, please refer to Parameters in the success callback function.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. var res = qg.getSystemInfoSync();
    2. console.log("on getSystemInfoSync: success =" + JSON.stringify(res));