Taro.getSystemInfoSync()
The synchronous version of Taro.getSystemInfo.
Type
() => 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
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
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.getSystemInfoSync | ✔️ | ✔️ | ✔️ |