HKObserverQuery Background Delivery

Originator:ruben
Number:rdar://40255384 Date Originated:May 15 2018
Status: Resolved:
Product:HealthKit Product Version:
Classification: Reproducible:
 
enableBackgroundDelivery(for:frequency:withCompletion:) is unavailable to watchOS.

Our app is a mental health tracker that brings in data from HealthKit to paint a better picture of what influences a user's mental health. Our idea for a new feature is to provide a prompt via local notification asking the user to rate how they feel immediately following the completion of a workout (or other HealthKit-related events like blood sugar, menstrual cycles, etc)

On iOS, using the background delivery feature of HKObserverQuery, we are able to deliver a local notification from the background. This is not possible if a HealthKit data point originates on watchOS until the data stores sync-up and our code is allowed to execute which our testing has shown only occurs after the iPhone is unlocked.

The ideal scenario here would be that HKObserverQuery on watchOS is able to listen for changes to its own HealthKit store and allow some code to execute. Here, we could trigger a local notification on watchOS that takes the user to our watchOS app to finish the task by rating how they feel after the workout.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!