悬浮窗权限调用
my.call("getAppAuthorizeSetting", {
success: (res) => {
console.log("悬浮窗权限调用成功:"+JSON.stringify(res))
},
fail: (res) => {
console.log(JSON.stringify("悬浮窗权限未开启:",res))
},
complete: (res) => {
console.log(JSON.stringify("悬浮窗权限未知:",res))
}
});
my.call("navigateToSetting", {
action: "overlay",
success: (res) => {
console.log("悬浮窗开启成功:"+JSON.stringify(res))
},
fail: (res) => {
console.log(JSON.stringify("悬浮窗开启失败:"+res))
},
complete: (res) => {
console.log(JSON.stringify("悬浮窗开启中:"+res))
}
})
连接WiFi配置
startWifi: function() {
my.call('startWifi', {
success: (res) => {
this.setData({
result: JSON.stringify(res),
});
},
fail: (res) => {
this.setData({
result: JSON.stringify(res),
});
},
complete: (res) => {
this.setData({
result: JSON.stringify(res),
});
}
});
},
connectWifi: function() {
my.call('connectWifi', {
'SSID': 'test',//WiFi名称
'password': '123456',//WiFi连接密码
success: (res) => {
console.log("connectWifi_success"+res),
this.setData({
result: JSON.stringify("连接成功"+res),
});
},
fail: (res) => {
console.log("connect fail:"+JSON.stringify(res)),
this.setData({
result: JSON.stringify("连接失败"+res),
});
},
complete: (res) => {
my.call('getConnectedWifi', {//获取当前连接WiFi信息
success: (res) => {
console.log("当前连接的WiFi:"+res.wifi.SSID),
this.setData({
result: JSON.stringify(res.wifi.SSID),
});
},
fail: (res) => {
this.setData({
result: JSON.stringify(res),
});
},
});
},
});
},