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

geolocation returning zero values (not errors)

I am building my first clockface for my new fitbit versa. I receive readings from the geolocation API, but all fields contain zero as the value. It appears that the device believes it is receiving a reading from my phone, but there it is not valid. Even when I cause my phone to pull its location (Google Maps or even the fitbit app), the zero values remain.

 

I have attempted acquiring the value both from geolocation.getCurrentPosition() and geolocation.watchPosition(); both supply the same zeroed-out readings.

 

I have Location enabled in package.json, so it shouldn't be a permission issue (there should be an error event in that case).

 

Sample reading:

{"accuracy":0,"latitude":0,"longitude":0,"altitude":0,"altitudeAccuracy":null,"heading":0,"speed":0}
Best Answer
0 Votes
7 REPLIES 7

Does the Fitbit mobile app definitely have access to location information in your phone's privacy settings?

Best Answer
0 Votes

I did check that early on and confirmed that all permissions are granted (including Location). I am developing for Android which displays an entry in the tray every time the GPS is queried.

 

When I call `geolocation.getCurrentPosition()` at a regular interval, I see the GPS entry appear at the same interval as those calls. When I register listeners with `geolocation.watchPosition()`, the GPS entry never leaves.

 

As soon as I disable the GPS portion of the app, the GPS entry disappears and remains absent. Clearly, the clockface is triggering the GPS activity, but the values remain zeroed out.

Best Answer
0 Votes

Can you put your project, or a minimal sample project onto Github, and I'll take a look on iOS and Android and see what's happening.

 

Thanks

Best Answer
0 Votes

I have made that version of the clockface available here: https://github.com/joeledwards/iso-plus/tree/location

 

Let me know if you have any additional questions about the issue.

Best Answer
0 Votes

Did you ever figure this out? I'm having the same issue.

Best Answer
0 Votes

I did get this working eventually. However, every time I pulled the Geo info, it would wake up the GPS. This resulted in a continuous query for GPS info and it ended up being a drain on my phone battery.

I suspect this is only an issue if you are attempting to incorporate this into a watch face.

 

Here is the app code for the version of the watch face which was pulling geo info successfully:

 

https://github.com/joeledwards/iso-plus/blob/location/app/index.js

 

UPDATE:

I needed to add a permission request into my package.json (also available in the above repo at the location branch).

Best Answer

Joining late at the party but i had a slioghtly different problem with  the Companion watchposition.

It alternates between a good reading and zero reading. My ugly solution was ?

 

if(!("latitude" in **ahem**.coords)){
if(debug)console.log("latitude not defined");
}else{
position = **ahem**
}

 

 

Best Answer
0 Votes