dlt.getSystemInfoAsync
Introduction
Asynchronously retrieve system information.
Usage Limitations
Supported in the basic library version 4.0.0 or higher.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for a successful API call. | |
| fail | function | No | Callback function for a failed API call. | |
| complete | function | No | Callback function for the completion of the API call (executed whether the call is successful or not). |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true - Successful retrieval. |
| model | string | Model of the phone. |
| pixelRatio | number | Device pixel ratio. |
| windowWidth | number | Window width in dp. |
| windowHeight | number | Window height in dp. |
| language | string | Set language following the ISO 639 standard. |
| frameworkversion | string | Mini-program basic library version. |
| storage | string | Device disk capacity. |
| currentBattery | string | Current battery percentage. |
| system | string | System version. |
| platform | string | System name: Android, iOS / iPhone OS. |
| screenWidth | number | Screen width in px. |
| screenHeight | number | Screen height in px. |
| brand | string | Phone brand. |
| packageName | string | Package name. |
| gaid | string | The device id of the host app. |
| country | string | Country. |
| mcc | string | Country code. |
| capsuleHeight | number | Capsule height in px. |
| capsuleWidth | number | Capsule width in px. |
| capsuleTranslationY | number | Capsule vertical offset in px. |
| capsuleTranslationX | number | Capsule horizontal offset in px. |
| statusBarHeight | number | Status bar height in px. |
object.fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | false - Retrieval failed. |
Sample Code
// pages/index/index.js
Page({
getSystemInfoAsync() {
dlt.getSystemInfoAsync({
success: (res) => {
console.log('systemInfo: ', res);
},
});
},
});