Search code examples
androidibm-mobilefirstworklight-geolocation

Worklight v6.0 Location Service issue : WIFI policy should include accessPointFilters specification


according to IBM Infocenter documentation, i've setup the following policy for WIFI location service:

function loadWifiLocation() {
  var policy = {
          Geo: {
              timeout: 3000,
              enableHighAccuracy: true
          },
          Wifi: {
              interval: 3000,
              signalStrengthThreshold: 15,
              accessPointFilters: [{SSID:"MYWIFI"}]
          }
  };
  WL.Device.Wifi.acquireVisibleAccessPoints(loadWifiLocationSuccess, loadWifiLocationFailure, policy);
}

Unfortunately, running on Android, the following error is thrown:

08-23 15:37:18.910: E/Web Console(17385): Uncaught Error: WIFI policy should include accessPointFilters specification at file:///data/data/com.InfoCenter/files/www/default/wlclient/js/deviceSensors/wifi.js:43

In the wifi.js file, the following line check the accessPointFilters attribute of policy:

if (policy.accessPointFilters == undefined)

But, in the Infocenter documentation, the accessPointFilters is not attribute of policy, but of policy.Wifi.... Either the documentation is wrong or the javascript libs code is bugged!

Anyway, i can't get it work (even with fixing the policy.accessPointFilters issue).


Solution

  • When calling acquireVisibleAccessPoints it expects only the Wifi part of the policy. For your code, could you please try passing in policy.Wifi as the third parameter instead of policy?