# wx.getSystemInfoAsync(Object object)
Start from base library version 2.14.1. Please remaining backward compatible.
with Promise style call: Not supported
Mini Program plugin: Not supported
Get system information asynchronously. Need some WeChat client version support, in the unsupported client, will use synchronization to return.
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# object.success callback
# parameter
# Object res
attribute | type | Introductions | Minimum version |
---|---|---|---|
brand | string | Equipment brand | 1.5.0 |
model | string | Device model. New models will show unknown for a while, WeChat will adapt as soon as possible. | |
pixelRatio | number | Device 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, unit px | |
windowHeight | number | Available window height, in px | |
statusBarHeight | number | Height of status bar in px | 1.9.0 |
language | string | Language of WeChat settings | |
version | string | WeChat version number | |
system | string | Operating System and Version | |
platform | string | Client platform | |
fontSizeSetting | number | User font size in px. WeChat ClientI - Settings - Universal - Font SizeThe settings in | 1.5.0 |
SDKVersion | string | Client base library version | 1.1.0 |
benchmarkLevel | number | Equipment Performance Level (only Android)。 Values are: -2 or 0 (the device cannot run games), -1 (performance unknown),>= 1 (Device Performance Value, higher the value, better device performance, currently up to less than 50) | 1.8.0 |
albumAuthorized | boolean | Allow WeChat to use the Photo Album switch (only iOS Effective) | 2.6.0 |
cameraAuthorized | boolean | Switch that allows WeChat to use the camera | 2.6.0 |
locationAuthorized | boolean | Allow WeChat to use location switch | 2.6.0 |
microphoneAuthorized | boolean | Switch allowing WeChat to use microphone | 2.6.0 |
notificationAuthorized | boolean | Switch that allows WeChat notifications | 2.6.0 |
notificationAlertAuthorized | boolean | Allow WeChat to notify switches with reminders (only iOS Effective) | 2.6.0 |
notificationBadgeAuthorized | boolean | Allow WeChat notifications with marked switches (only iOS Effective) | 2.6.0 |
notificationSoundAuthorized | boolean | Allow WeChat to notify switches with sound (only iOS Effective) | 2.6.0 |
phoneCalendarAuthorized | boolean | Switch that allows WeChat to use the calendar | 2.19.3 |
bluetoothEnabled | boolean | Bluetooth System Switch | 2.6.0 |
locationEnabled | boolean | Geographic Location System Switch | 2.6.0 |
wifiEnabled | boolean | Wi-Fi System switch | 2.6.0 |
safeArea | Object | A safe area in the positive direction of the vertical screen | 2.7.0 |
locationReducedAccuracy | boolean | true Represents fuzzy positioning,false For precise positioning, only iOS Support | |
theme | string | System current theme, with a value oflight ordark , global configuration'darkmode': true Can be obtained when otherwise undefined (Small games not supported) | 2.11.0 |
host | Object | Host environment for current Mini Programs | 2.12.3 |
enableDebug | boolean | Whether debugging is turned on. Available from the top right menu or wx.setEnableDebug Turn on debugging. | 2.15.0 |
deviceOrientation | string | Equipment direction |
safeArea Structure
attribute | type | Introductions |
---|---|---|
left | number | Upper left abscissa of security area |
right | number | Security area lower right abscissa |
top | number | Top-left ordinate of security area |
bottom | number | Lower right ordinate of security area |
width | number | Width of security area, unit logical pixels |
height | number | Height of Safe Area, Unit Logical Pixels |
theme Legal value
value | Introductions | Minimum version |
---|---|---|
dark | Dark theme | |
light | Light color theme |
host Structure
attribute | type | Introductions |
---|---|---|
appId | string | host app Corresponding appId |
deviceOrientation Legal value
value | Introductions | Minimum version |
---|---|---|
portrait | Vertical screen | |
landscape | Horizontal screen |
# sample code
wx.getSystemInfoAsync({
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)
}
})