uni.startWifi({
success: (res) => {
console.log('hhh', res);
// 获取当前连接的Wi-Fi信息
if (res.errMsg == 'startWifi:ok') {
// this.wifiName = ""
// this.wifiInputDisable = !!this.wifiName
console.log('aazoubuzou 里面', );
uni.getConnectedWifi({
success: (ress) => {
console.log('ress', ress);
this.wifiName = ress.wifi.SSID
this.wifiInputDisable = !!this.wifiName
this.wifiFun() //获取wifi名
if (type != 1) {
if (this.isAndroid()) {
this.accessCoarseLocation(
"android.permission.ACCESS_COARSE_LOCATION"
); //模糊位置权限(蓝牙\ble依赖)
}
}
},
fail: (err) => {
console.log('err', err);
if (type != 1) {
this.wifiName = ""
this.wifiInputDisable = !!this.wifiName
this.$showModal({
content: this.$t(
'mattressPw.notConnectedToWiFi'
), //未连接WiFi网络,无法配网
showCancel: false, // 是否显示取消按钮,默认为 true
}).then(res => {}).catch(err => {})
}
if (err.errCode == 12005) {
this.wifiName = ""
this.wifiInputDisable = !!this.wifiName
console.log('aazoubuzou ', );
}
},
complete: (aa) => {
console.log('aa', aa);
}
});
}
},
fail: (err) => {
console.log(err);
}
});
//开始搜寻附近的蓝牙外围设备
startBluetoothDevicesDiscovery(){
uni.startBluetoothDevicesDiscovery({
allowDuplicatesKey: false, //是否允许重复上报同一设备
interval: 0, //搜索间隔
success(res) {
//console.log(res)
//console.log("开始搜寻附近的蓝牙外围设备")
},
fail(err) {
this.errList(err); //错误提示
}
})
},
1 个回复
3***@qq.com (作者)
使用插件市场"获取周围wifi "上述两款手机也返回空数组,其余安卓机正常返回搜索到的WiFi列表