title: Taro.getSystemInfoSync()

sidebar_label: getSystemInfoSync

The synchronous version of Taro.getSystemInfo.

Reference

Type

  1. () => Result

Parameters

Result

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

Property Type Description
SDKVersion string Client base library version
albumAuthorized boolean The switch that allows WeChat to use Photos (only for iOS)
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).
bluetoothEnabled boolean The system switch for Bluetooth
brand string Device brand
cameraAuthorized boolean The switch that allows WeChat to use the camera
fontSizeSetting number User’s font size in px. The setting in Me > Settings > General > Text Size in the WeChat app prevails.
language string Language set in WeChat
locationAuthorized boolean The switch that allows WeChat to use the location function
locationEnabled boolean The system switch for the GPS function
microphoneAuthorized boolean The switch that allows WeChat to use the microphone
model string Device model
notificationAlertAuthorized boolean The switch that allows WeChat to send notifications with reminders (only for iOS)
notificationAuthorized boolean The switch that allows WeChat to send notifications
notificationBadgeAuthorized boolean The switch that allows WeChat to send notifications with flags (only for iOS)
notificationSoundAuthorized boolean The switch that allows WeChat to send notifications with sound (only for iOS).
pixelRatio number Device’s pixel ratio
platform string Client platform
safeArea SafeAreaResult Safe area when the screen is in vertical orientation
screenHeight number Screen height in px
screenWidth number Screen width in px
statusBarHeight number Status bar height in px
system string Operating system and version
version string WeChat version
wifiEnabled boolean The system switch for Wi-Fi
windowHeight number Available window height in px
windowWidth number Available window width in px

Sample Code

  1. try {
  2. const res = Taro.getSystemInfoSync()
  3. console.log(res.model)
  4. console.log(res.pixelRatio)
  5. console.log(res.windowWidth)
  6. console.log(res.windowHeight)
  7. console.log(res.language)
  8. console.log(res.version)
  9. console.log(res.platform)
  10. } catch (e) {
  11. // Do something when catch error
  12. }

API Support

API WeChat Mini-Program H5 React Native
Taro.getSystemInfoSync ✔️ ✔️ ✔️