title: Create geo triggers dynamically worklight
body: <p>I am implementing geofence in worklight but I want to create geo triggers dynamically. I saw this <a href="https://stackoverflow.com/questions/20274792/how-to-set-location-triggers-dynamically-in-worklight">post</a> and tried her code but it's not working for me. I used fake location and entered a geofence but the callback function was not triggered. Here's my code. <em>branch_data_g</em> is a json string containing the longitude and latitudes.</p>
  
  <pre><code>function getFirstPositionAndTrack() {
      WL.Logger.info("getfirstpositionandtrack function");
      // use GPS to get the user's location
      var geoPolicy = WL.Device.Geo.Profiles.LiveTracking();
      geoPolicy.timeout = 60000; // set timeout to 1 minute
      geoPolicy.maximumAge = 10000; // allow to use a position that is 10 seconds old
  
      // note: to see at high-accuracy, change RoughTracking above to LiveTracking
  
      // get the user's current position
      WL.Device.Geo.acquirePosition(
              function(pos) {
                  WL.Logger.debug("acquired position");   
                  WL.Logger.debug("Longitude: " + pos.coords.longitude);
                  WL.Logger.debug("Latitude: " + pos.coords.latitude);
  
                  var triggers = new Object();
                  triggers.Geo = {};
  
                  var trigger_events = generateTrigger();
  
                  triggers.Geo = trigger_events;              
  
                  WL.Device.startAcquisition({ Geo: geoPolicy }, triggers, { Geo: alertOnGeoAcquisitionErr } );
              },
              function(geoErr) {
                  alertOnGeoAcquisitionErr(geoErr);
                  // try again:
                  getFirstPositionAndTrack();
              },
              geoPolicy.Geo
          ); 
  }
  
  function generateTrigger() {
      var parsed_data = JSON.parse(branch_data_g);
      WL.Logger.info("generatetrigger function: " + parsed_data.branches.length);
      var trigger_events = new Object();
      WL.Logger.info("sample: " + parsed_data.branches[0].latitude);
      for(var i = 0; i &lt; parsed_data.branches.length; i++) {
          var trigger = {
                  type: "Enter",
                  circle: {
                      longitude: parsed_data.branches[i].longitude,
                      latitude: parsed_data.branches[i].latitude,
                      radius: 100
                  },
                  callback: function() {
                      WL.Logger.info("Enter branch");
                      WL.Client.transmitEvent({ branch: "enter branch"}, true);
                  }
          };
          trigger_events["branch"+i] = trigger;
      }
  
      return trigger_events;
  }
  </code></pre>
  
  <p>Here's my code in my adapter:</p>
  
  <pre><code>function eventHandler() {
      //nothing to do here..
  }
  
  WL.Server.setEventHandlers([
      WL.Server.createEventHandler({branch: 'enter branch'}, eventHandler)
  ]);
  </code></pre>
  
  <p>Am I missing something? Thanks in advance!</p>