getWifiList
Introduction
Requests to retrieve a list of available Wi-Fi networks (For Android, foreground applications can use this API up to 4 times within 2 minutes).
Parameters
None
Sample Code
Page({
data: {
wifiStatus: '',
getWifiListStatus: '',
},
onReady() {
this.startWifi().then(() => {
this.getWifiList();
});
},
startWifi() {
const _that = this;
return new Promise((resolve, reject) => {
dlt.startWifi({
success: function (res) {
console.log('startWifi success', res);
_that.setData({
wifiStatus: 'startWifi',
});
resolve(res);
},
complete: function (res) {
console.log('startWifi complete', res);
},
fail: function (res) {
console.log('startWifi fail', res);
reject(res);
},
});
});
},
getWifiList() {
const _that = this;
dlt.getWifiList({
success: function (res) {
console.log('getWifiList success', res);
_that.setData({
getWifiListStatus: res,
});
},
complete: function (res) {
console.log('getWifiList complete', res);
},
fail: function (res) {
console.log('getWifiList fail', res);
_that.setData({
getWifiListStatus: res,
});
},
});
},
});