About HealthKit background delivery

I have some doubts about how HealthKit background delivery has been behaving, any information would be greatly appreciated.


  • After setting up background delivery and setting the frequency to hourly, my application gets called only ocassionally in the background, around two times every 5 hours, Is this normal behavior?
  • Do HKObserverqueries need to be recreated everytime the app launches from a terminated or similar state?
  • Is there any delay between enabling the background delivery and actually getting the background delivery, assuming there is new data available every hour?
  • The HKObserverQueries UpdateHandler are getting executed everytime the app is brought to the foreground, is this expected behavior?

Regarding the completionHandler that is received in the updateHandler of HKObserverQueries:

  • Should the completionHanlder be called right away inside the UpdateHandler?
  • If for some reason the three strikes are reached due to not calling the completionHandler in a timely manner. Does background delivery stop permanently?

I have a sample project ready if needed.

Replies

is your project working on iOS 9? It is not working for me. The HKObserverQuery is not beeing triggered when the steps change.

I seem to be having similar issues with iOS 9.1 and Observer queries not firing in the background. It would help if there were better documentation/samples on how this is supposed to work.

Don't forget that the health data store is locked if the iphone is locked. So I would expect background updates will be empty if they occur while the device is locked. Is that possibly related to the behavior you are seeing?