The guide advises that the geolocation.watchPosition's callback "is called each time the location changes."
In a continuously moving environment (e.g. a racing yacht) the location is changing continuously, which casts doubt on that. My questions are:
I am interested in hearing more as well. I could not get watchposition to work, based on the example in the guide. Geolocation works, but watchposition does not export data. If someone is looking into this, can you let me know if I should change something from the example?
Best Answer
@agsurf5 wrote:I am interested in hearing more as well. I could not get watchposition to work,
So what did you get? Could you post your code and its results?
Best AnswerI used the code from the guide:
https://dev.fitbit.com/guides/geolocation/#monitoring-the-current-location
Can an get the coordinates for getCurrentPosition, but not for watchPosition
do you get anything from your loctionSuccess function?
function locationSuccess(position) { console.log("Latitude: " + position.coords.latitude, "Longitude: " + position.coords.longitude); }
Reading the Guide it seems you should only get a response "...each time the location changes." Which contradicts the Reference on watchPosition() :"Request that the system monitor the position continuously and report position updates as available"
I wonder what is really going on?
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
There is definitely a bug with watchPosition(), I've escalated this with the firmware team.
The API is designed in partity with:
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
Best Answer
@JonFitbit wrote:
- Is the callback actually called every second, on the second?
This depends upon how you configure the options. See below.
I didn't see any ref to configure the options.
And what is the nature of the bug you have escalated?
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
@raceQs wrote:
@JonFitbit wrote:
- Is the callback actually called every second, on the second?
This depends upon how you configure the options. See below.I didn't see any ref to configure the options.
And what is the nature of the bug you have escalated?
The options were on the link, sorry https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions
The bug is that watchPosition() doesn't seem to be working.