Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HKWorkoutSession not resuming custom workout app if screen gets locked or active app changed

I have a watchOS 2 app that displays health data during a run. I start a workout using HKWorkoutSession as follows:

self.workoutSession = HKWorkoutSession(activityType: .Running, locationType: .Outdoor)
self.workoutSession!.delegate = self;
self.healthStore.startWorkoutSession(self.workoutSession!)

This keeps my app in the foreground when the screen shuts off for a while and the user looks at it again later.

Now lets say during the workout the user switches to a different app OR the watch screen locks (due to the watch not being secured tight enough) and then the user re-launches my running app by double clicking the digital crown. The app resumes where it left off and continues to get health data as expected, but my app won't stay in the foreground anymore. The workout is still in progress because on the watch face I can still see the workout icon at the top, and the heart rate monitor continues to collect heart rate data, but the app refuses to stay in the foreground.

Does anyone have any idea on how to have a workout app resume to the foreground during a workout even if the screen locks or a user switches to a different app?

like image 935
lehn0058 Avatar asked Oct 02 '15 19:10

lehn0058


1 Answers

I contacted Apple using one of my 2 yearly technical support requests. According to the representative I talked to, he believes this is a bug in watchOS. I had submitted this as a bug report way back in October, but the ticket has gotten no response so I thought I was perhaps missing something. I guess we are stuck with how this works for the time being.

like image 185
lehn0058 Avatar answered Oct 22 '22 21:10

lehn0058