05-27-2020 02:13
05-27-2020 02:13
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.
Answered! Go to the Best Answer.
05-28-2020 10:42
05-28-2020 10:42
It seems that the OS Simulator doesn't support units.distance, it always returns kms.
Author | ch, passion for improvement.
05-27-2020 03:04
05-27-2020 03:04
The API always returns metres. It's up to you to work out if you need to convert, and to do so if needed.
05-27-2020 08:30
05-27-2020 08:30
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.
05-27-2020 13:14
05-27-2020 13:14
https://dev.fitbit.com/build/reference/device-api/user-settings/
05-28-2020 06:54
05-28-2020 06:54
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.
05-28-2020 10:42
05-28-2020 10:42
It seems that the OS Simulator doesn't support units.distance, it always returns kms.
Author | ch, passion for improvement.
05-28-2020 15:52
05-28-2020 15:52
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
05-28-2020 16:08
05-28-2020 16:08
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).
05-28-2020 16:26
05-28-2020 16:26
@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.
05-29-2020 04:42
05-29-2020 04:42
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.