HomeDocs
Skip to main content

onGetWifiList

Introduction

Wi-Fi scan result event listener.

Parameters

None

Callback Return Parameters

Object res

ParameterTypeDescription
wifiListArray.<wifiInfo>Wi-Fi info

Sample Code

Page({
data: {
wifiStatus: '',
getWifiList: 0,
},
onReady() {
this.startWifi().then(() => {
this.onGetWifiList();
});
},
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);
},
});
});
},
onGetWifiList() {
const _that = this;
dlt.onGetWifiList((res) => {
console.log('onGetWifiList==: ', res);
_that.setData({
getWifiList: res.length,
});
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.