10-19-2017 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-19-2017 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello,
I used the code exactly like in your example:
https://dev.fitbit.com/guides/geolocation/
with the method "watchposition()".
First of all I expected to see the sign for GPS like in the Running-Training in the left upper corner - but nothing appeared there.
Then after a walk outside I tried to get some geolocation data to the fitbit app.-- but also nothing was recorded.
How can I store the gps-data of a run with the ionic and transfer it to the fitbit app similair to the trainings? -- Have I to do this all by my own programming or do you have some available functions or methods available for this?
Thanks
Capitano

10-20-2017 08:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-20-2017 08:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You would need to write your own solution, but we provide all of the building blocks.
In your case, you'd probably need to use:
- GPS API
- Filesystem API
- Messaging API
- fetch()

10-24-2017 13:18 - edited 10-24-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-24-2017 13:18 - edited 10-24-2017 13:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@Capitano I encouter the same struggles as you. Do you have a working geolocation example? I want to use the GPS of the Watch, but haven't managed to do so. getting the current position works but watching position not. According to the documentation the only difference would be to change geolocation.getCurrentPosition to geolocation.watchPosition
@JonFitbit . In general I would expact that a copy paste of example works out of the box.
10-24-2017 13:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-24-2017 13:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You can use this until the watchPosition() method is working.
import { geolocation } from "geolocation"; function locationSuccess(**ahem**) { console.log("success: " + JSON.stringify(**ahem**)); } function locationError(err) { console.log("error: " + err.message); }; function locationUpdate() { geolocation.getCurrentPosition(locationSuccess, locationError); } setInterval(locationUpdate, 1000);

10-25-2017 14:18 - edited 10-26-2017 04:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-25-2017 14:18 - edited 10-26-2017 04:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@JonFitbit I tried this one as well. Simply changed "**ahem**" to "data" as it would not built.
Lasted 4 seconds, and it crashed/closed. Please see log down here.
[5:14:40 PM]error: Position Unavailableapp/index.js:11 [5:14:41 PM]success: {"coords":{"accuracy":40.57,"latitude":40.726347,"longitude":-73.968422,"altitude":7.25,"altitudeAccuracy":null,"heading":89.43,"speed":0.15433319999999998},"timestamp":1508966080000}app/index.js:8 [5:14:43 PM]success: {"coords":{"accuracy":38.65,"latitude":40.726345,"longitude":-73.968457,"altitude":7.27,"altitudeAccuracy":null,"heading":17.7,"speed":0.22121091999999998},"timestamp":1508966081000}app/index.js:8 [5:14:44 PM]success: {"coords":{"accuracy":36.35,"latitude":40.726332,"longitude":-73.968489,"altitude":7.27,"altitudeAccuracy":null,"heading":338.25,"speed":0.18519984},"timestamp":1508966083000}app/index.js:8 [5:14:45 PM]success: {"coords":{"accuracy":35.3,"latitude":40.726334,"longitude":-73.968506,"altitude":7.27,"altitudeAccuracy":null,"heading":327.33,"speed":0.24693312},"timestamp":1508966084000}app/index.js:8

10-26-2017 13:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-26-2017 13:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sorry, it looks like my code sample was caught by the profanity filter 🙂
It's definitely working here, so unfortunately you may need to wait for the next firmware update. It's coming soon.

10-26-2017 20:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-26-2017 20:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hahaha! Love it.
i tested today the watch gps using regular activities, and no problems. Works without crashing. I am not really sure why it is not working when coding geolocation on the studio. I’ll wait for the next firmware and hopefully it will solve it. If anybody managed to have geolocation working so far, please let me know.

10-27-2017 01:02 - edited 10-27-2017 01:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-27-2017 01:02 - edited 10-27-2017 01:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
If the interval of the code example is set to 3 seconds, then it will work. See below my working code example.
import { geolocation } from "geolocation"; import document from "document"; var latlonData = document.getElementById("latlon-data"); var speedheadingData = document.getElementById("speedheading-data"); var GPSoptions = { enableHighAccuracy: true, maximumAge: Infinity }; var counter = 0; setInterval(getPosition, 3000); function getPosition() { geolocation.getCurrentPosition(locationSuccess, locationError); } var position = {coords:{ latitude:50.123456789, longitude:4.123456, heading: 69.9999, speed:9.56789 }, timestamp:12345567788 }; latlonData.innerText = "Retrieving GPS..."; function locationSuccess(**ahem**) { counter++; position = **ahem**; var lat = position.coords.latitude; var lon = position.coords.longitude; var heading = position.coords.heading; var speed = position.coords.speed; latlonData.innerText = lat.toFixed(4) + " "+ lon.toFixed(4); speedheadingData.innerText = speed.toFixed(1)+"m/s "+Math.round(heading)+"°"; } function locationError(error) { counter++; latlonData.innerText = "GPS not found "+counter; console.log("GPS not found"); console.log(`Error: ${error.code}\nMessage: ${error.message}`); }
10-27-2017 04:50 - edited 10-27-2017 08:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-27-2017 04:50 - edited 10-27-2017 08:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for the code. I changed mine and it does not crash at 3 sec. I tested 2 seconds and it still crashes.
3 seconds is not accurate enough for some activities, unfortunately. Garmins they all sample at 1 second no issues.
Is this a limitation of the Ionic, or just some growing pain in the firmware?

10-27-2017 05:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-27-2017 05:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Pieterothanks for the code.
I'm on vacation actually but absolutely looking forward to work with this example next week!
Capitano

10-29-2017 16:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-29-2017 16:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hey @Pietero
Changed my code to reflect yours.
It is way more stable. But it still crashes. I tried at 1 second, and it lasts almost a minute before crashing. At 3 seconds it crashes about 2 minutes in.
Do you experience the same issue, or is yours perfectly stable over time?
I am not an expert, but it looks like the Ionic reaches the limit of some data buffer. Am I supposed to dump the old data after each successful new geolocation read?

10-30-2017 00:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-30-2017 00:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello,
@Pieterocould also try your code and experienced the same effect. App is running for a couple of seconds (with intervall = 1000ms) and then stopps.
Capitano

11-15-2017 05:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-15-2017 05:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
03-27-2021 05:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-27-2021 05:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Heyy can you tell me the geolocation code in python??

