How often my Apple Watch does sync with Health App?

Hi!

We are building an app that collect steps counts.

We are testing on an Apple Watch. Our case scenario is that tester uses both iPhone and watch during the day then removes the Watch around 10.30pm and goes to bed. iPhone is always within 2m of the watch so within range for a sync.

Our tester usually checks the app in the morning and when the app opens, we are collecting the steps from HealthKit that occurred until 11h59mn59s last night. At this stage, we do believe that the watch did synchronise (maybe multiple times) with Health App during the night so Health Data and steps count returned by HealthKit should be the same.

However, we can observe that the app data always shows a (small) difference compare to the Health App.

(One can note that it works fine when our tester only uses an iPhone for the steps count.)

Does anyone know how often the Apple Watch does sync with the Health App and where is the flaw in our approach?

Thanks!

What you are probably seeing as a discrepancy is the fact that HK prioritizes step data. So, sometimes it will prioritize steps from the watch over the phone or vice versa. This is an unknown internal process that apple uses to exclude step data. We compared days of steps data and mapped it out as much as possible trying to reverse engineer this process with no success.

If you look at "all data" for steps you will see records written by phone and watch. Sometimes the record start and end times overlap or one record is completely inside the timeframe of another record. Apple does something to prioritize those scenarios to not double count records. If your app simply gets all steps from a point in time you will have data that is all over the place.

What worked for us was redesigning our app so that users choose the phone or the watch as step source. Then in our HK query we simply make a predicate that includes either "Watch" or "Phone". We found this to be the way to get the most accurate steps and not end up with inflated numbers due to double counting phone and watch.

Hope this helps a little.

How often my Apple Watch does sync with Health App?
 
 
Q