Search code examples
iosgpshealthkit

Keep iOS app running while indoor workout is tracked on the Phone


I have an iOS app where users can track workouts on the Phone (not AppleWatch). Outdoor is pretty clear. I have my GPS and that keeps my app running in the background and that works perfectly fine.

But now we'd like to add an indoor workout mode as well and f.e. record the users pace using the CMPedometer.

Is there a way I can keep my app running? Runkeeper seems to have a StopWatch mode without GPS?!? But how do you do that?


Solution

  • In my old CoreMotion recording app I use:

    [[UIApplication sharedApplication] setIdleTimerDisabled: YES];
    

    to keep the device from going into the background while I track the CoreMotion data.