HealthKit, built-in sleep detection does not work outside sleep schedule

369 Views Asked by At

Do I understand correctly that the HealthKit sleep tracking feature does not always read past sleep (start datetime, end datetime)? It only works when enabled in the settings and 'understands' when a person has fallen asleep exclusively within the time frame that the user has set as the desired "start" and "end" of sleep (I mean what is shown in the screenshot below)?

I'll give you an example: I fell asleep during the day, not at night - HealthKit has 0 information about past sleep, apple watch didn't even detect that.

Another example: I fell asleep at night, apple watch woke me up with an alarm at the end of my "desired" sleep interval, I turned it off and continued sleeping. As a result, the clock counted that I slept until the alarm rang and then was awake.

As a corollary question, in order to 100% define the session of sleep in my app, I have to write my own algorithm and do not rely on apple watch built-in sleep tracking? I need advices.

...

0

There are 0 best solutions below