Skip to main content
Version: Next

Taro.getSystemInfoSync()

The synchronous version of Taro.getSystemInfo.

Reference

Type

() => Result

Parameters

Result

NOTE: Version, statusBarHeight, fontSizeSetting, SDKVersion are not supported on the H5.

PropertyTypeDescription
SDKVersionstringClient base library version
albumAuthorizedbooleanThe switch that allows WeChat to use Photos (only for iOS)
benchmarkLevelnumberThe 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).
bluetoothEnabledbooleanThe system switch for Bluetooth
brandstringDevice brand
cameraAuthorizedbooleanThe switch that allows WeChat to use the camera
fontSizeSettingnumberUser's font size in px. The setting in Me > Settings > General > Text Size in the WeChat app prevails.
languagestringLanguage set in WeChat
locationAuthorizedbooleanThe switch that allows WeChat to use the location function
locationEnabledbooleanThe system switch for the GPS function
microphoneAuthorizedbooleanThe switch that allows WeChat to use the microphone
modelstringDevice model
notificationAlertAuthorizedbooleanThe switch that allows WeChat to send notifications with reminders (only for iOS)
notificationAuthorizedbooleanThe switch that allows WeChat to send notifications
notificationBadgeAuthorizedbooleanThe switch that allows WeChat to send notifications with flags (only for iOS)
notificationSoundAuthorizedbooleanThe switch that allows WeChat to send notifications with sound (only for iOS).
pixelRationumberDevice's pixel ratio
platformstringClient platform
safeAreaSafeAreaResultSafe area when the screen is in vertical orientation
screenHeightnumberScreen height in px
screenWidthnumberScreen width in px
statusBarHeightnumberStatus bar height in px
systemstringOperating system and version
versionstringWeChat version
wifiEnabledbooleanThe system switch for Wi-Fi
windowHeightnumberAvailable window height in px
windowWidthnumberAvailable window width in px

Sample Code

try {
const res = Taro.getSystemInfoSync()
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)
} catch (e) {
// Do something when catch error
}

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getSystemInfoSync✔️✔️✔️