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

Units bug in OS simulator

ANSWERED

I'm trying to read the length units, "metric" or "us", but always get metric in the OS simulator 0.8.2

 

import { units } from "user-settings";
console.log(units.distance);

 

Is this a bug?

Is there a workaround?

 

I'm happy to always get the actual distance returned in metric in my SimpleClock watch face app but I need to know whether to convert it to US, where can I get this information from?

 

Author | ch, passion for improvement.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

It seems that the OS Simulator doesn't support units.distance, it always returns kms.

Author | ch, passion for improvement.

View best answer in original post

Best Answer
9 REPLIES 9

The API always returns metres. It's up to you to work out if you need to convert, and to do so if needed.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thanks, thats what I thought.

 

The problem isn't that, its to find out if it needs to be converted.

 

How can you find out if the mobile app has length set to miles?

Author | ch, passion for improvement.

Best Answer
0 Votes
Best Answer
0 Votes

In the OS Simulator the API units.distance always returns "metric" regardless of the mobile app settings.

 

Does the Simulator not check the live settings? Its not a setting that can be altered in the Simulator.

Author | ch, passion for improvement.

Best Answer
0 Votes

It seems that the OS Simulator doesn't support units.distance, it always returns kms.

Author | ch, passion for improvement.

Best Answer

The most frequent support question I used to get was how to change to or from Celsius.

 

After a few months of explaining how to modify their profiles, I added a setting that defaults on start to the value in units (i.e. units.temperature).

 

This also allows me to test the metric/imperial function using the simulator

Best Answer
0 Votes

I think this needs clarification. It's not a simulator-specific issue. The API call always returns metres, including on physical watches with US units selected: see here. Conversion from metres to other units must always be done in clockface/app code; it is not done within the OS (API).

Peter McLennan
Gondwana Software
Best Answer
0 Votes

@Gondwana wrote:

I think this needs clarification. It's not a simulator-specific issue. The API call always returns metres, including on physical watches with US units selected: see here. Conversion from metres to other units must always be done in clockface/app code; it is not done within the OS (API).


Yes, that is true, but determining what to convert and when is available in user-settings which always returns 'metric' from the simulator.

 

You can test using a physical watch by changing the user profile, but a good number of users don't readily grasp how to change their own profile, so you may end up adding your own setting for this anyway.

 

Weirdly enough if you want to change the temperature units from the profile, you need to change the length units from the user profile.

Best Answer
0 Votes

Thanks all,

 

It appears that the OS Simulator does not have its own settings for units.distance and does not check the user's preferences either, it just has metric hard coded.

 

Perhaps an enhancement to the simulator would be an improved settings section where any of the values from the user's preferences could be changed, including all the data values such as steps, time, calories, enabling auto increments or fixed values.

 

This would make testing 10 times easier, how about it folks?

 

The Fitbit environment, community and development is generally great, bar a few glitches. It would be easy to improve it more by having a better settings page in the Simulator.

Author | ch, passion for improvement.

Best Answer