09-01-2018 17:15
09-01-2018 17:15
I want to write a program that displays a message on my Ionic watch face when a certain latitude and longitude are reached. I am not sure of the javascript syntax required to access the GPS coords. Any suggestions? NB, I have some programming experience in a variety of languages but I am not a professional programmer.
Thanks
09-03-2018 10:25
09-03-2018 10:25
You can use watchPosition() as detailed here: https://dev.fitbit.com/build/guides/geolocation/
Depending on the accuracy of the location, you might want to limit the number of decimal places when comparing the lat and lon.
Something vaguely like:
if (position.coords.latitude.toFixed(2) === -0.12 && position.coords.longitude.toFixed(2) === 51.50) { // roughly in London }
09-03-2018 15:20
09-03-2018 15:20