System information can be obtained synchronously through uni.getSystemInfoSync(), where platform is to obtain the client platform
switch(uni.getSystemInfoSync().platform){
case 'android':
console.log('客户端是Android')
break;
case 'ios':
console.log('客户端是iOS')
break;
case 'devtools':
console.log('客户端是在开发者工具上')
break;
default:
console.log('客户端是在其他工具上')
break;
}
The mobile phone information can be obtained according to different parameters, the parameters are as follows:
parameter | Description | Platform difference description |
---|---|---|
brand | Mobile phone brands | App, WeChat applet, Baidu applet, ByteDance applet, QQ applet |
model | Phone model | |
pixelRatio | Device pixel ratio | |
screenWidth | Screen width | |
screenHeight | Screen height | |
windowWidth | Usable window width | |
windowHeight | Usable window height | |
windowTop | The top position of the usable window | App、H5 |
windowBottom | The bottom position of the usable window | App、H5 |
statusBarHeight | The height of the status bar | ByteDance applet does not support |
navigationBarHeight | The height of the navigation bar | Baidu applet |
titleBarHeight | Title bar height | Alipay applet |
language | App settings language | ByteDance applet does not support |
version | Engine version number | H5 does not support |
storage | Device disk capacity | Alipay applet |
currentBattery | Current battery percentage | Alipay applet |
appName | Host APP name | ByteDance Mini Program |
AppPlatform | App platform | QQ applet |
host | Host platform | Baidu applet |
app | Currently running client | Alipay applet |
cacheLocation | Last cached location information | Baidu applet |
system | Operating system version | |
platform | Client platform, the value range is: ios, android | |
fontSizeSetting | User font size setting. Subject to the settings in "Me-Settings-General-Font Size", unit: px | WeChat applet, Alipay applet, Baidu applet, QQ applet |
SDKVersion | Client base library version | Alipay applet and H5 are not supported |
swanNativeVersion | Host platform version number | Baidu applet |
albumAuthorized | Switch to allow WeChat to use photo albums (available only on iOS) | WeChat Mini Program |
cameraAuthorized | Switch to allow WeChat to use the camera | WeChat Mini Program |
locationAuthorized | Allow WeChat to use location switch | WeChat Mini Program |
microphoneAuthorized | Switch to allow WeChat to use the microphone | WeChat Mini Program |
notificationAuthorized | 允许微信通知的开关 | 微信小程序 |
notificationAlertAuthorized | 允许微信通知带有提醒的开关(仅 iOS 有效) 微信小程序 | |
notificationBadgeAuthorized | 允许微信通知带有标记的开关(仅 iOS 有效) 微信小程序 | |
notificationSoundAuthorized | 允许微信通知带有声音的开关(仅 iOS 有效) 微信小程序 | |
bluetoothEnabled | 蓝牙的系统开关 | 微信小程序 |
locationEnabled | 地理位置的系统开关 | 微信小程序 |
wifiEnabled | Wi-Fi 的系统开关 | 微信小程序 |
safeArea | 在竖屏正方向下的安全区域 | App、H5、微信小程序 |
safeAreaInsets | 在竖屏正方向下的安全区域插入位置(2.5.3+) | App、H5、微信小程序 |