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?