wx.getSystemInfo(Object object)
Gets system information.
Parameters
Object object
Attribute | Type | Default | Required | Description |
success | function | | No | The callback function for a successful API call |
fail | function | | No | Callback function for failed API call |
complete | function | | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
object.success callback function
Parameters
Object res
Property | Type | Description | Minimum Version |
brand | string | Device brand | 1.5.0 |
model | string | Device model | |
pixelRatio | number | Device's pixel ratio | |
screenWidth | number | Screen width in px | 1.1.0 |
screenHeight | number | Screen height in px | 1.1.0 |
windowWidth | number | Available window width in px | |
windowHeight | number | Available window height in px | |
statusBarHeight | number | Status bar height in px | 1.9.0 |
language | string | Language set in WeChat | |
version | string | WeChat version | |
system | string | Operating system and version | |
platform | string | Client platform | |
fontSizeSetting | number | User's fnt size in px. The setting in Me > Settings > General > Text Size in the WeChat app prevails. | 1.5.0 |
SDKVersion | string | Base library version for the WeChat app | 1.1.0 |
benchmarkLevel | number | The device performance grade (only for Mini Games on Android). Values: -2 or 0 (the device cannot run the Mini Game), -1 (unknown performance), ≥1 (a higher value (up to 50) indicates a better performance). | 1.8.0 |
albumAuthorized | boolean | The switch that allows WeChat to use Photos (only for iOS) | 2.6.0 |
cameraAuthorized | boolean | The switch that allows WeChat to use the camera | 2.6.0 |
locationAuthorized | boolean | The switch that allows WeChat to use the location function | 2.6.0 |
microphoneAuthorized | boolean | The switch that allows WeChat to use the microphone | 2.6.0 |
notificationAuthorized | boolean | The switch that allows WeChat to send notifications | 2.6.0 |
notificationAlertAuthorized | boolean | The switch that allows WeChat to send notifications with reminders (only for iOS) | 2.6.0 |
notificationBadgeAuthorized | boolean | The switch that allows WeChat to send notifications with flags (only for iOS) | 2.6.0 |
notificationSoundAuthorized | boolean | The switch that allows WeChat to send notifications with sound (only for iOS). | 2.6.0 |
bluetoothEnabled | boolean | The system switch for Bluetooth | 2.6.0 |
locationEnabled | boolean | The system switch for the GPS function | 2.6.0 |
wifiEnabled | boolean | The system switch for Wi-Fi | 2.6.0 |
safeArea | Object | Safe area when the screen is in vertical orientation | 2.7.0 |
res.safeArea is composed as follows:
Property | Type | Description |
left | number | The x-coordinate of the top-left corner of the safe area |
right | number | The x-coordinate of the bottom-right corner to of the safe area |
top | number | The y-coordinate of the top-left corner of the safe area |
bottom | number | The y-coordinate of the bottom-right corner to of the safe area |
width | number | Safe area width in logical pixels |
height | number | Safe area height in logical pixels |
Sample Code