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

geolocation doesn't work?

ANSWERED

I am following the sample code here:

https://dev.fitbit.com/guides/geolocation/#overview

 

However, when I tried it, I got a message of "Position Unavailable" and error code is 2. I did request GPS location permission in my package.json. What else am I missing?

 

 

Best Answer
1 BEST ANSWER

Accepted Solutions

I would imagine that's how long it takes to get a fix from the satellites. The API doesn't cache any location information, but I assume you could do that yourself to give you the previous location, while you're waiting.

 

Alternatively, you could initially ask the Companion for its GPS location, then update it when you have the Device coordinates.

View best answer in original post

Best Answer
5 REPLIES 5

Are you doing this in the companion app? Could you check the location permissions on your phone? Perhaps you didn't grant the Fitbit app use of your GPS.

 

One way you can trigger the permissions prompt in the Fitbit mobile app, is to click the "+" button on the home dashboard screen, and try to manually add an exercise.

Best Answer

I found that every time I started the app, I need to wait 5-10 seconds and then the GPS service will work. This delay is not acceptable for my purpose. 

 

The settings of Fitbit app for location service is for the phone, not for the watch? So that setting shouldn't matter?

Best Answer
0 Votes

@dajian888 wrote:

The settings of Fitbit app for location service is for the phone, not for the watch? So that setting shouldn't matter?


It depends if you're using the Device API, or Companion API. The Companion API requires location permission from the mobile device.

Best Answer

I see. Thanks for the reply. I am using device API to get GPS location. Any insight on why it is not working until I wait about 5-10 seconds after app started?

Best Answer
0 Votes

I would imagine that's how long it takes to get a fix from the satellites. The API doesn't cache any location information, but I assume you could do that yourself to give you the previous location, while you're waiting.

 

Alternatively, you could initially ask the Companion for its GPS location, then update it when you have the Device coordinates.

Best Answer