01-22-2021 03:19
01-22-2021 03:19
The piece of code below works on All simulator versions, SDK4 but not on SDK5.
Though the Versa 3 and Sense have a built in GPS, I would like to get the location from the phone as the fix is faster and the chance is high that it had a recent location.
The **ahem** object is empty when running it on an Fitbit sense using a sideloaded app.
var GPSFix = false;
var GPSoptions = {
enableHighAccuracy: true,
maximumAge: 600000,
};
geolocation.getCurrentPosition(locationSuccess, locationError, GPSoptions);
function locationSuccess(**ahem**){
console.log("companion:location found"+JSON.stringify(**ahem**));
GPSFix = true;
sendFile("GPSPosition.txt",**ahem**);
}.
Best Answer01-22-2021 08:45
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.
01-22-2021 08:45
I assume you're testing this outside? Have you checked that the Fitbit Exercise app is actually getting a GPS fix? I was testing my Alpine Snow app and it took quite a while to get the very first fix, but was ok after that.
Best Answer01-22-2021 08:51 - edited 01-22-2021 08:51
01-22-2021 08:51 - edited 01-22-2021 08:51
Jon,
Well, the LocationSucces function got an empty object. I guess the LocationSuccess function is only called when a GPS fix was made. I was indoors, at a window. And my phone gets a gps signal when I'm at this window.
BTW that **ahem** is a santiy filter on this forum? I don't know that position without "ition" means in Enlish, but it must be bad.
Best Answer01-31-2021 11:32
01-31-2021 11:32
Hi @JonFitbit ,
I assume this bug is on the issue list of fitbit?
Today I did some more test. The position object passed to the locationSuccess function is always empty on SDK5. I'm using a Huawei P10, which is not supported, but it does work on sdk4.
It does not matter if I use getCurrentPosition or Watchposition. If I run google maps in the background to be sure that my GPS is active, it still gives an empty object.
It is not a major issue, but there are use cases when it makes more sense to use the phones GPS instead of the built in GPS. For example, I use it to fetch some data from the open Wheater API.
Best Answer