Getting locations periodically

Getting locations periodically

  
Good day.

I'm using the "DeviceFeatures\GetLocation" plugin to retrieve my mobile device' location. It all works fine, but my requirement is that this information should be retrieved and stored at X interval.

You have pointed my in a direction where I can use triggers and I will further explore this. My question is that this plugin requires a control to fire it off. Is there a way that I can fire this off without needing to depend on a control?

Solution
Hi Jean,

Yes you can!
You can do something like what follows

setTimeout(function() { navigator.geolocation.getCurrentPosition(OutSystemsNative_GPSOnSuccess.bind(null, latInput, longInput, altInput, headInput, speedInput, timeInput), OutSystemsNative_GPSOnError.bind(null), { enableHighAccuracy: true })}, 5000);
The above code will be obtaining the coordenates each 5 seconds.

Let me know if this helps!
cheers,
RG
Solution
Ruben.

Thank you.

Where should I do this?
IMO, you should create a webblock that would have that JS (you should also copy the functions OutSystemsNative_GPSOnSuccess and OutSystemsNative_GPSOnError as well)-
You would then add this webblock to the page where the functionality would be used.
Thanks for this.

Where do I locate those functions (OutSystemsNative_GPSOnSuccess,OutSystemsNative_GPSOnError)?

So if I implement it as you suggest. Where will it write the Lat and Long to? I have an action that stores it in my db ... "AddAgentLocation". It receives the Lat and Long and writes it to the database. My current implementation has two hidden inputs on the screen. I use the OutSystemsNow GetLocation function to populate the inputs. Then I write to the database through an onchange event.

Thanks