小程序wx.getSystemSetting
Object wx.getSystemSetting()
獲取設備設置
基礎庫 2.20.1 開始支持,低版本需做兼容處理。
小程序插件:支持,需要小程序基礎庫版本不低于 2.21.3
返回值
Object
屬性 類型 說明
bluetoothEnabled boolean 藍牙的系統開關
locationEnabled boolean 地理位置的系統開關
wifiEnabled boolean Wi-Fi 的系統開關
deviceOrientation string 設備方向
合法值 說明
portrait 豎屏
landscape 橫屏
示例代碼
const systemSetting = wx.getSystemSetting()
console.log(systemSetting.bluetoothEnabled)
console.log(systemSetting.deviceOrientation)
console.log(systemSetting.locationEnabled)
console.log(systemSetting.wifiEnabled)