功能
loadWifiTracking() {
var policy = {
Wifi: {
interval: 3000,
signalStrengthThreshold: 15,
accessPointFilters: [{SSID:"wifiName"}]
}
};
var triggers = {
Wifi: {
DwellInSide: {
type: "DwellInside",
areaAccessPoints: [{SSID: 'wifiName'}],
callback:function() {alert("Thank You For Being Here!");},
dwellingTime: 5000
},
Connected: {
type: 'Connect',
connectedAccessPoint:[{SSID: 'wifiName'}],
callback: function() {alert("Reached Here");}
},
}
};
WL.Device.startAcquisition(policy, triggers, acquisitionFailure);
var acquisitionFailure = {
Wifi : wifiFailure,
};
function wifiFailure(positionError) {
alert("pe" + positionError);
}
}
这是一个错误:
The WIFI Connect trigger with network specification: [{"SSID":"wifiName"}] will have no affect, since this network do not appear in WIFI acquisition policy.
任何想法究竟是什么问题?请帮忙。
答案 0 :(得分:2)
Connected: {
type: 'Connect',
connectedAccessPoint:[{SSID: 'wifiName'}],
callback: function() {alert("Reached Here");}
},
正如您在Connect
触发器中看到的那样,属性connectedAccessPoint
是单数。因此,您不应传递SSID数组,而应传递单个SSID。
尝试:
Connected: {
type: 'Connect',
connectedAccessPoint:{SSID: 'wifiName'},
callback: function() {alert("Reached Here");}
},