Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.
API | Description |
|---|---|
Obtains system information. | |
Obtains system information in synchronous mode. |
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. |
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. |
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. |
qg.getSystemInfo({
success(res) {
console.log("on getSystemInfo: success =" + JSON.stringify(res));
},
fail() {
console.log("on getSystemInfo: fail");
},
complete() {
console.log("on getSystemInfo: complete");
}
}); "brand":"HUAWEI",
"model":"C*T-A**0",
"pixelRatio":3,
"screenWidth":360,
"screenHeight":746.6666666666666,
"windowWidth":360,
"windowHeight":746.6666666666666,
"language":"zh",
"region":"CN",
"script":"Hans",
"coreVersion":"1.1.21",
"COREVersion":"1.1.21",
"system":"Android 10",
"platform":"ANDROIDOS",
"version":"3.6.1.2",
"statusBarHeight":0,
"platformVersionName":"1.106",
"platformVersionCode":1106,
"safeArea":{
"bottom":746.6666666666666,
"left":0,
"right":360,
"top":0,
"height":746.6666666666666,
"width":360
} For details, please refer to Parameters in the success callback function.
var res = qg.getSystemInfoSync();
console.log("on getSystemInfoSync: success =" + JSON.stringify(res));