Worklight - Connect Trigger In Wifi Is Throwing An Error
-
21-12-2019 - |
Question
function
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);
}
}
It's throwing an error:
The WIFI Connect trigger with network specification: [{"SSID":"wifiName"}] will have no affect, since this network do not appear in WIFI acquisition policy.
Any Idea what is the exact problem? Please do help.
Solution
Connected: {
type: 'Connect',
connectedAccessPoint:[{SSID: 'wifiName'}],
callback: function() {alert("Reached Here");}
},
As you can see in the case of the Connect
triggers, the property connectedAccessPoint
, is singular. Therefore you should not pass an array of SSIDs, but rather a single SSID.
Try:
Connected: {
type: 'Connect',
connectedAccessPoint:{SSID: 'wifiName'},
callback: function() {alert("Reached Here");}
},
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow