22
Views
3
Comments
[Health & Fitness Plugin] Health and Fitness Plugin - Inconsistencies with time, calories and time zones
health-fitness-plugin
Mobile icon
Forge asset by OutSystems
Application Type
Mobile
Service Studio Version
11.54.60 (Build 63294)
Platform Version
11.25.0 (Build 41743)

Hi,

We're implementing the Health and Fitness plugin and we require samples of Steps, Heart Rate, Calories and Sleep.

We are using the AdvancedQuery action to retrieve all data for the variables listed above, per hour over the last month. This is a requirement on our side to facilitate a daily chart view. 

We have however come across the following issues, and I would appreciate any assistance.

Devices are running Android 13, 14 and iOS 16.7.8

iOS Local Time

The times for the readings are in local time. Android returns them in UTC. 

This now means I have to determine whether the reading time is in UTC or not, and no, I cannot simply use TextToDateTime() because that would then convert the Android readings incorrectly, which are already in UTC. I also don't want to make the assumption that all iOS devices are going to return the readings in local time.

It would be nice if the plugin could return all readings in UTC. That way I can have all server queries comparing UTC times for both platforms. I shouldn't have to implement special cases per platform or device setup. 

iOS Sleep

Using the AdvancedQuery action for sleep on iOS does not work. I get error code 102, which from the plugin source, looks like an authorization issue. I have ALL variables set to read and write on the iOS device.

Using the GetHealthData action for sleep does work, however it is useless to me since it only returns a list of decimals with one entry and no time attached to it.

Unit of measure (Calories)

Calories are not reported in a consistent unit of measure as stated in the documentation. On iOS I can take one reading in cal, then the next in kcal (using the Health app). The plugin will then report the values in their respective unit of measure. 

On Android 13 using GoogleFit, switching between cal and kj makes no difference, the values are always reported in cal and not kcal as per the documentation. 

Android Samsung Health

One of our test devices is an Android 14 device with Samsung Health 6.26.6.001. Calories are reported in a very strange format. Below is the result from the AdvancedQuery action. 

Firstly, the device is set to record in kcal. These readings cannot possibly be correct. It looks like a Samsung specific value where I have to substract the first reading from the last in order to get something that resembles an accurate reading for the day in cal. (17979-16047=1932cal?, which would be roughly correct for this individual). It should be reported in a consistent manner as with the other setups. 


2021-02-17 18-31-05
Alexandre Jacinto
Staff

Hi @Christo Van Niekerk!


May I ask what version of the Health and Fitness plugin you're using?

Best regards,

Alexandre Jacinto

2025-01-31 07-14-38
Christo Van Niekerk

Hi Alexandre, 

I'm currently on 2.1.0. I got the errors on version 2.0 as well, with no difference between the two.

UserImage.jpg
Ricardo Silva

Hey @Christo Van Niekerk,

I had a look into your post and would appreciate it if you could clarify a few topics:

  • Regarding the iOS Sleep, are you using a valid operation for the queries? If yes, can you provide some examples of what you're facing?
  • I'm unsure if I understood what you meant with the Unit of measure (Calories) section. Can you detail it a bit more, please?

BR.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.