Health Kit Background Delivery and URLSession.shared.dataTask

This thread has been locked by a moderator; it no longer accepts new replies.

Hello. I have implemented background delivery for detecting changes in health kit with HKObserverQuery. It works well, I am reading changes. And I am sending this changes to an https endpoint with using an URLSession.shared.dataTask inside the HKObserverQuery callback while my app is terminated. I have several questions about this:

  1. Is starting a URLSession.shared.dataTask inside HKObserverQuery callback is correct way to do it?
  2. I am calling HKObserverQuery completion handler whatever dataTask returned success or failure but I am wondering what if the network connection is low and this dataTask response could not received in 2-3 seconds. I have read HealthKit background deliveries should take 1-2 seconds.

Should I use background task somehow for sending those HTTPS requests?

Answered by DTS Engineer in 854004022

Let’s focus this discussion on your other thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Boost

Let’s focus this discussion on your other thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Health Kit Background Delivery and URLSession.shared.dataTask
 
 
Q