Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPS

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

Best Answer
0 Votes
2 REPLIES 2

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
}
Best Answer
0 Votes
Thank you. I will give it a go...
Best Answer
0 Votes